Home > Mobile >  How to properly set up react for my website
How to properly set up react for my website

Time:11-03

I am still a beginner in React therefore i habe watched a lot of different tutorials. Most of them have set up react via npm on there local system. Of course when testing everything works fine since you still host via ur loca system. So i ask myself how do you do this when you really want to host the website. do you need to install react the same way on your web server? is there an easier way? or am I missing sonething completely?

The only solution i have seen was using these links in my html file:

  <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>  <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>

but these apparently come with a downside

CodePudding user response:

If you want to host the website you have to build the build folder.

To create the build folder use the command,

npm run build # run the "build" package script

Only after this, you should drop this folder in the websites where you want to host your project.

The build folder is already present when you run npm install but only after this command you will be able to add changes to it.

You can find the build folder in the folder structure.

Here is the image of the same.

[here1

  • Related