does react really need nodeJS on the frontend ENV?

前端 未结 2 1097
陌清茗
陌清茗 2021-01-31 04:13

I am new in react. I want to start a small hello world example of my own.

Most tutorials offer something like this:

app.js

var React = require(\'         


        
2条回答
  •  抹茶落季
    2021-01-31 05:05

    The answer to the question posed in the title is no, you do not need node.js to use React on the client side.

    In fact, the second example you give is doing just that - using React on the client side without any mention of node.js.

    That said, there are a couple of different ways to use node.js that are very useful when building React-based applications.

    Use a node.js-based build tool like browserify or webpack to bundle your client-side code into a neat, tidy package which you then serve to the client.

    For example, in a project I'm working on, I use browserify to build a single Javascript file saved at public/js/bundle.js which is included via a plain old

提交回复
热议问题