Home >Web Front-end >Front-end Q&A >What is the difference between react and javascript?
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.
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">
import SearchRoomStyle from './searchRoom.css';
import ForgetUser from '../components/ForgetUser.js'
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!