Home > Software engineering >  How to create simple React app without internet connection
How to create simple React app without internet connection

Time:11-06

I live in Ukraine, Kyiv. And due to the constant terrorist acts of russia, I very often have no electricity. However, there is a desire to learn React. But there is a dillema: How to create, view and deploy simple react app, because i know that

npm init vite
npm create-react-app

they all need internet connection to dowload data etc.

So how can i create local react app and when internet restores, publish it?

Probably codesandbox?

CodePudding user response:

Really Hope the circumstances get better.

You don't need internet to develop in react, once you have installed all the npm dependencies. So whenever you have internet, just execute those commands and all the dependencies will be downloaded in a folder called node_modules.

Once that is complete, you can run npm start which will serve the app locally (without internet) on localhost:3000 and it will automatically open that url in a web browser.

But keep in mind, that if your app accesses a remote API or data, then you would need internet for that.

CodePudding user response:

As soon as you have all the needed packages installed, you can develop local without the need of an internet connection. create-react-app also comes with a preconfigured local webserver server where your app gets deployed to by using npm start.

In addition, you can use Verdaccio. That is some sort of proxy/cache for npm. Once correct configured, it caches all used npm packages on your local machine. Then you can also create new react apps without the need of an internet connection. Setting up Verdaccio is pretty straight forward.

  • Related