I started to look into ReactJS. It seems that Facebook just released version 15.0.1. I looked into this framework last year, during 0.12.x version, when it was using JSXTransformer, and now it seems it went away from it.
Now it seems that almost every tutorial suggests using latest React with Webpack. Is there a way not use webpack at all? I'm trying to find a good valid example with a grunt task for React 15.x.x.
Any help would be appreciated.
You don't need webpack. You don't even need JSX, you can just write React.
When (not) to use @babel/standalone. If you're using Babel in production, you should normally not use @babel/standalone. Instead, you should use a build system running on Node. js, such as Webpack, Rollup, or Parcel, to transpile your JS ahead of time.
No more introduction let's start creating React app without using create-react-app. First of all you need to have install node in your computer. To check that you can run following command in your CLI. Now let's initialise our React project using init command.
Configuring webpack provides complete control over the development environment, while initializing with Create React App prevents any custom configuration by default.
The simplest way:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <div id="root"></div> <script src="https://unpkg.com/react@16/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> <script type="text/babel"> class Hello extends React.Component{ render() { return <p>Hello {this.props.name}</p>; }; } ReactDOM.render( <Hello name='World'/>, document.getElementById('root'), ); </script> </body> </html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With