I am completely new to React JS or any server technology. And now I want to learn how to develop in React JS.
Introduction
I started with React JS tutorials on the official website. Now I am trying to import a response toolbar or any other third-party component into my JSX code. But I ran into the uncaught exception error: require not defined
problem.
When I searched about it, I found out about various build mechanisms (browserify, webpack, gulp), to which I was completely new (again). After reading this data and looking at some examples , I had my browser compile the require()
statements written in my .jsx
files.
Problem
I am trying to do the following:
- Write a
.html
file. - Run it through my
server.js
file. - Add a
<script>
tag to it that will inject my .jsx
code into my .html
file.
The examples that I have seen so far ( 1 , 2 and some others ...) upload the .js
file at the beginning and write their .html
code in the .jsx
files ( render()
function).
Question
Is it possible to download the .html
file from server.js
and use the .jsx
from the <script>
in this .html
file? Something like that:
<html> . . <body> <div id="container"></div> <script src="path_to_reactjs_file"></script> </body> </html>
I apologize if this sounds like a completely stupid question, but because I am completely unfamiliar with this technology, I cannot understand how I should do it.
Any help would be appreciated.
source share