D
D
Dmitry Bychkov2020-08-14 00:31:26
Node.js
Dmitry Bychkov, 2020-08-14 00:31:26

NodeJS React and WP how to compile a project into 1 JS file?

Explain to an amateur, let's say I have a page on wordpess in the body of which there is some <div id="container">how I can configure react in such a way that it is assembled into a js file that I simply connect to the desired page, and it works and renders what I need in the container.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
McBernar, 2020-08-14
@McBernar

You can include React like a regular js script.

<script src="https://unpkg.com/[email protected]/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" crossorigin></script>

And in the same file place all the React code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question