What is the difference between react and javascript?

青灯夜游
Release: 2021-10-15 16:33:06
Original
3878 people have browsed it

Differences: 1. The way of writing class is different, js is "class", and react is "className"; 2. The way of writing style is different, js is "style="attribute:value"", and react is "style={ {Attribute: "value"}}"; 3. React variables are braces and js are quotation marks.

What is the difference between react and javascript?

The operating environment of this tutorial: windows7 system, javascript1.8.5&&react16 version, Dell G3 computer.

The writing format of React code is very different from the previous JS.

1. How to write style class

javascript: class

react:className

2. How to write style (react camel case naming)

javascript: style="background-color:white"

react:style={{ backgroundColor: "white"}}

3. Variables (react variables are braces, js are quotes)

javascript: onClick=" clickSearch(e)"

react:onClick={(e)=>this.clickSearch(e)}

4. Introduction of resources

javascript:

  • css: <link rel="stylesheet" href="../css/iuapmobile .um.css">

  • ##js:      

#react:

  • css:

    import SearchRoomStyle from './searchRoom.css';

  • js:

    import ForgetUser from '../components/ForgetUser.js'

For more programming related knowledge, please visit :

Introduction to Programming! !

The above is the detailed content of What is the difference between react and javascript?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!