An open API service indexing awesome lists of open source software.

https://github.com/phalbert/pure-react

Explore react like the guy who first imported the script into index.html
https://github.com/phalbert/pure-react

pure react

Last synced: 7 months ago
JSON representation

Explore react like the guy who first imported the script into index.html

Awesome Lists containing this project

README

          

# pure-react
Explore react like the guy who first imported the script into index.html

## React Without JSX
JSX is not a requirement for using React. Using React without JSX is especially convenient when you don’t want to set up compilation in your build environment.

Each JSX element is just syntactic sugar for calling React.createElement(component, props, ...children). So, anything you can do with JSX can also be done with just plain JavaScript.

For example, this code written with JSX:

```javascript
class Hello extends React.Component {
render() {
return

Hello {this.props.toWhat}
;
}
}

ReactDOM.render(
,
document.getElementById('root')
);
```

can be compiled to this code that does not use JSX:

```javascript
class Hello extends React.Component {
render() {
return React.createElement('div', null, `Hello ${this.props.toWhat}`);
}
}

ReactDOM.render(
React.createElement(Hello, {toWhat: 'World'}, null),
document.getElementById('root')
);
```