From 8f5ea0d7e3248a9596d902235c6bf57fb8eefac8 Mon Sep 17 00:00:00 2001 From: Nathan Yeo Date: Sat, 24 Aug 2024 19:41:07 +0800 Subject: [PATCH] Update explanations for main.jsx boilerplate code Removed mentions of importing React and ReactDOM directly. --- react/introduction/setting_up_a_react_environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react/introduction/setting_up_a_react_environment.md b/react/introduction/setting_up_a_react_environment.md index 5a19f52f931..b3531843de4 100644 --- a/react/introduction/setting_up_a_react_environment.md +++ b/react/introduction/setting_up_a_react_environment.md @@ -118,10 +118,10 @@ createRoot(document.getElementById("root")).render( Whoa! There's quite a lot here. You are not expected to recognize much of this (if any) right now. Here's a brief rundown of what is happening: -1. We import `React` itself and its fellow `ReactDOM` package. +1. We import `StrictMode` and `createRoot` from the `react` and `react-dom` packages respectively. 1. We import the `App` component from `App.jsx`, so that we may place (render) it within the DOM. 1. We import some CSS styling (you may recognize this syntax from the Webpack material). -1. We create a `root` object by invoking `ReactDOM.createRoot` with an element from our `index.html`. +1. We create a `root` object by invoking `createRoot` with an element from our `index.html`. 1. We invoke the `render` method which is attached to our `root` object, with some very interesting-looking syntax inside the parentheses. All of this may understandably look unlike anything you've seen up until now, but have no fear, once you've spent the time with this course, you'll know exactly what all of this does, and *much more*.