Search code examples
javascriptreactjsreact-routerbabeljsreact-dom

How to add a standard react app without using node.js


In enterprise projects, Authentication and Authorization is different because we use SSO (Single Sign On) or use an internal CDN (Content Delivery Network) to read some data in Client web Application.

In some projects like this the program lines are written with most accurate. you can see folders and files are also made up SOLID and etc conventions.

In a project that at least has 50 sub systems if I use react in one project (create-react-app) this project gives me at least 126 folders. (CREATE - REACT - APP) gives me a lot of folders that do not have any performance for me. On the other hand I need to have a structure with up to ten script files to add them to CDN project and clean coding.

What I want: I want a few simple scripts to allow me to make components without limitation. Now adding just the react, react-dom , react routing , babel , browser js scripts impossibility of use Import, Export components.

Please help me to understand how to import and export components without adding create-react-app.

The best option for me would be to have a link or help me by telling me what should I add to my project.


Solution

  • The official documentation (here: https://reactjs.org/docs/try-react.html) mentions a static html file (this: https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html) that includes the import script to work with React in a single file, without the need of having it installed.

    Look at the source code of the html file, specifically at these lines:

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

    Let me know if this is what you are looking for.