I tried putting the code from VS Code in which I first created the folder structure using create-react-app. Then I tried to copy paste the code from vscode to codepen but I am not understanding whether why the output is not displayed in codepen and also the tests are failing.
I have also tried putting only the content of <body> in the html part of codepen but no effect.
thank you this worked but I have a doubt:
i didn’t understand this statement(is it a type of organisation of code?) Move the render code to the bottom of the file.
Configure Babel as the preprocessor and add the required libraries below it, where it says Search CDNjs:
(You must add react or react-js and react-dom)
type React in add external scripts and you will get the option
The code where you add the root component to the render should be at the bottom of the file so it doesn’t reference code before the code is defined. It would normally be inside a separate entry point file (index/main) in a standard React project setup.
But yes, even if its location doesn’t cause an issue I’d expect to find it at the bottom so you might call it code organization as well.
If you add the dependencies as scripts don’t also add them as modules (what I posted). Use one or the other. I’d suggest staying with module imports from https://esm.sh/