Re:New React docs pretend SPAs don't exist anymore
by jameshart on Friday March 17, 2023 @07:49PM
(#35204464)
You can actually still do this, and it is kind of a shame it's not documented on react.dev
You need to pull in react, plus Babel standalone, and then you can use <script type="text/jsx"> tags, which means you can bootstrap react components onto your page. But you are going to be basically running a compiler in your user's web browser. That's fine if you want to run that way, but Babel has docs that explain why you probably shouldn't (https://babeljs.io/docs/babel-standalone#when-not-to-use-bab...).
Re:New React docs pretend SPAs don't exist anymore
by brailsafe on Sunday March 19, 2023 @09:07PM
(#35225883)
Building up my initial knowledge like you describe was the only way I could generate the enthusiasm for working on top of so many layers of abstraction.
You need to pull in react, plus Babel standalone, and then you can use <script type="text/jsx"> tags, which means you can bootstrap react components onto your page. But you are going to be basically running a compiler in your user's web browser. That's fine if you want to run that way, but Babel has docs that explain why you probably shouldn't (https://babeljs.io/docs/babel-standalone#when-not-to-use-bab...).
All you need is these two scripts:
[Edit - also need ReactDOM, sorry: ]I think it would help if more react tutorials started from here, because it shows why you need a build process.
Here, as a JSFiddle: the React 'Hello World' they don't want you to see: https://jsfiddle.net/smLa1bco/