0

Is it possible to use react locally without web-access and without a server?

For other HTML/css/script stuff it is possible to just browse a file using an URL like "file:///myFile.html". I have seen https://stackoverflow.com/a/30270618/4142984 but, firstly I don't use chrome and secondly I don't want to be seen on the net every time I do a little testing. (And, yes, I'm not just a little paranoid.)

So I've downloaded the js-files and replaced

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

with

<script src="react-development.js" ></script>
<script src="react-dom.development.js"></script>

and I get:

Uncaught TypeError: React is undefined

Adding the code suggested here https://stackoverflow.com/a/26347762/4142984 I get

Uncaught ReferenceError: React is not defined

Is there a way to fix it, and if so, how?


One reason behind this question is that I don't trust the cloud: one hack to the server or one man(m/w/x)-in-the-middle attack and everything based on it will fail (best case) or do real damage.

Gyro Gearloose
  • 1,056
  • 1
  • 9
  • 26
  • Have you tried [this](https://reactjs.org/docs/create-a-new-react-app.html#create-react-app)? You can make your app and run a server on localhost. – Sumit Chaturvedi Nov 04 '20 at 13:51
  • @SumitChaturvedi Yes, but I would like to run without a server (browser only), ***and*** it gets me into version hell: "You are running Node 8.10.0. Create React App requires Node 10 or higher. Please update your version of Node. " And I already did 3 to 5 updates like that. – Gyro Gearloose Nov 04 '20 at 13:57
  • did you even check your network tab if the js-ressources were even found and loaded? relative uris are always sketchy and I assume thats your issue – john Smith Nov 04 '20 at 15:26
  • okay, to take your paranoia, running a local webserver is exactly as secure as your machine is anyways. Because the only way to get hacked is your machine is hacked and not the running server-software, maybe you should go with simple apache/mysql than running node – john Smith Nov 04 '20 at 15:34
  • @johnSmith that much, that well, but code-run-debug-(drink) cycles are much shorter without a server. – Gyro Gearloose Nov 04 '20 at 15:38
  • @johnSmith this is going to be a chat. I've never created on. Can you open one? – Gyro Gearloose Nov 04 '20 at 15:50
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/224101/discussion-between-john-smith-and-gyro-gearloose). – john Smith Nov 04 '20 at 15:50

1 Answers1

1

Better off using a different language or creating your own javascript framework.

Here's an example on how to build your own framework https://levelup.gitconnected.com/how-i-wrote-javascript-framework-59b40dca3366?gi=208530978b11

  • "Better off using a different language or creating your own javascript framework." ... You made my day! ... Unfortunately, customers employing freelancers have there own opinions on what to use. – Gyro Gearloose Nov 04 '20 at 15:34
  • I frequently actually **did** make my own frameworks from scratch; solid, efficient and focused. – Gyro Gearloose Nov 04 '20 at 15:45