Home >Web Front-end >Front-end Q&A >What is the difference between react and javascript?

What is the difference between react and javascript?

青灯夜游
青灯夜游Original
2021-10-15 16:33:063954browse

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!

Statement:
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