i´m using react without node js using the <script type="text/babel"></script>
mi first view is a login so i want to know if i can redirect to another html file with another view,
or if i can create another class component in the same file where is the login class and use ReactDOM.render to show the other component in the same login file
for example…
class Login extends React.Component{
return the login view
}
class ListUser extends React.Component{
return the view of list user
}
I’m trying to understand what you ment, but to start with generally you will only use ReactDOM.render() once. There may be exceptions, and that is partly why ReactDOM.portal() now exists.
If I understand you currectly then yes absolutly you can link to another html file that loads a different React script to load that pages view. This could lead to a fair bit of repeated code though.
What I would suggest doing is looking into react-router to compose a single page app. depending on your environment, you may need to use it’s hash router if not all requests are directed to one main index.html file.
Is there a reason you want to do this without node?
thank you very much for the answer, i´m trying to do that because i´m working in a web dynamic project in eclipse and i have to create an EAR file.
so that was the unique way that i found to use react in html file, i´m trying to make a reactDom.render two times because i don´t know how to make a redirect in the project eclipse to another html file with react,
aa okey so i can use ReactDOM.portal or ReactDOM.unmountComponentAtNode to “destoy” the view login and render the list view.
another thing i can´t use the import inside the <script type="text/babel"> </script>
can you tell me if i have to include another js file? i read that i have to import the babel-core js file but the babel-standalone include that too
or can you give an example of that, i know how to do that in react project but not in html file using react
and sorry if can´t explain correctly but i´m not so good in english XD
Unfortunately, I’m not really familiar with Eclipse, from what I looked up it seems to be related to Java programs. I’ve done next to nothing with Java. Do you have a public git repo where the code you have currently is available on GitHub or GitLabs?
yes, it´s only for java, i had to use eclipse because i have to generate an EAR file to deploy the view in Jboos Server and that was the only way to generate an EAR and use react, but you give me an idea yesterday i´m going to use CDN for Router and look if work XD.