mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
Clarify
This commit is contained in:
@@ -28,17 +28,17 @@ Now let's take a closer look at the differences between the old and the new tran
|
||||
|
||||
When you use JSX, the compiler transforms it into React function calls that the browser can understand. **The old JSX transform** turned JSX into `React.createElement(...)` calls.
|
||||
|
||||
For example,
|
||||
For example, let's say your source code looks like this:
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
|
||||
function App() {
|
||||
return <h1>Hello World</h1>;
|
||||
return <h1>Hello World</h1>;
|
||||
}
|
||||
```
|
||||
|
||||
gets transformed to
|
||||
Under the hood, the old JSX transform turns it into regular JavaScript:
|
||||
|
||||
```js
|
||||
import React from 'react';
|
||||
@@ -48,6 +48,10 @@ function App() {
|
||||
}
|
||||
```
|
||||
|
||||
>Note
|
||||
>
|
||||
>**Your source code doesn't need to change in any way.** We're describing how the JSX transform turns your JSX source code into the JavaScript code a browser can understand.
|
||||
|
||||
However, this is not perfect:
|
||||
|
||||
* Because JSX compiled into `React.createElement`, `React` needed to be in scope if you use JSX.
|
||||
|
||||
Reference in New Issue
Block a user