Building an app with components
To start building an application, here's a block of HTML you can start with:
<!doctype HTML> <HTML lang="en"> <body> <div id="root"></div> </body> </HTML>
These days, we have more and more SPAs that update parts of pages on the fly, which makes using the website feel like a native application. A quick response time is what we are aiming for. JavaScript is the language to deliver this goal, from displaying the user interface to running application logic and communicating with the web server.
To add logic, React takes over one section of the HTML to start a component:
<script> const App = () => { return <h1>Hello World.</h1> } const rootEl = document.getElementById("root") ReactDOM.render(<App />, rootEl) <...