Using React with an existing application with JSX












2














We are planning to switch new technologies like react for my CMS project which is under development for 10 years.



Until now everything was simple and plain on the front end.



First include jquery.js then if necessary include the components and third party scripts, then code and dance with the DOM.



But now while trying to jump into a higher level of technology and different approach, things can easily get very complicated for me.



After spending more than 10 hours with React documents and tutorials I have a very good understanding about what it is and how it works.



But I realized that I am very unfamiliar with some popular concepts. I never used node.js, never used npm, babel, webpack, and may other many "new" things I have seen every where. I am face to face with these tools because of React and I am convinced that these are the inevitable for modern front end development.



Now the question



Our CMS runs on PHP and depends on MooTools heavily at the front end. Instead of a complete rewrite of a 10 years old CMS I just want to try new technologies partially for some cases. Decided to starting with React.



For the case I want to integrate ag-Grid to React also.



What I did not understand is that how to bring all these tools together.



I won't be able to use the simply include js way of react because of ag-Grid.



In the examples the code written has some JSX. Which means that we write JSX and run it translated for the browser to test if it is ok.




  • Each time before testing do I need to translate these files?

  • And more over if the files are translated does debugging become very
    complicated?

  • Can babel make it on the run time? If yes is it a good practice.

  • There are lots of file in the node_modules folder. Which of them
    should I include for production?


All sources on the net are very theoretical and assumes a knowledge. Need some guidance for best practices.



There are lots of questions and not a single step by step guide from beginning to production.










share|improve this question






















  • You may not use JSX syntax at all and avoid the transpilation step altogether, React isn't tied to JSX: it's just a library that establishes unidirectional data flow and renders raw data into DOM in an efficient way. I think you are at the point where you still need to do more research and decide if you really need to migrate to React, quite honestly.
    – rm-
    Nov 10 at 14:12










  • There are lots of questions and not a single step by step guide from beginning to production - step by step tutorials are out of scope of SO, There's certain learning curve with React tooling. It's hard to embrace modern JS workflow at once if you don't have enough experience with necessary things (Node, Babel, Webpack).
    – estus
    Nov 10 at 14:35












  • Actualy we do not realy migrate to React now but I see popular tools like jquery wont be able to meet modern needs in the near future. Our mostly used library MooTools came at the end of it's life cycle. I dont think jquery will last too long because ES is able to replace it. A complete migration of our CMS is not possible today. But we want to see how things go with React and try it in a small Module of CMS. That is the idea. I feel integrating React is not a good idea instead of starting from scratch. What do you think?
    – Zortext
    Nov 11 at 9:21
















2














We are planning to switch new technologies like react for my CMS project which is under development for 10 years.



Until now everything was simple and plain on the front end.



First include jquery.js then if necessary include the components and third party scripts, then code and dance with the DOM.



But now while trying to jump into a higher level of technology and different approach, things can easily get very complicated for me.



After spending more than 10 hours with React documents and tutorials I have a very good understanding about what it is and how it works.



But I realized that I am very unfamiliar with some popular concepts. I never used node.js, never used npm, babel, webpack, and may other many "new" things I have seen every where. I am face to face with these tools because of React and I am convinced that these are the inevitable for modern front end development.



Now the question



Our CMS runs on PHP and depends on MooTools heavily at the front end. Instead of a complete rewrite of a 10 years old CMS I just want to try new technologies partially for some cases. Decided to starting with React.



For the case I want to integrate ag-Grid to React also.



What I did not understand is that how to bring all these tools together.



I won't be able to use the simply include js way of react because of ag-Grid.



In the examples the code written has some JSX. Which means that we write JSX and run it translated for the browser to test if it is ok.




  • Each time before testing do I need to translate these files?

  • And more over if the files are translated does debugging become very
    complicated?

  • Can babel make it on the run time? If yes is it a good practice.

  • There are lots of file in the node_modules folder. Which of them
    should I include for production?


All sources on the net are very theoretical and assumes a knowledge. Need some guidance for best practices.



There are lots of questions and not a single step by step guide from beginning to production.










share|improve this question






















  • You may not use JSX syntax at all and avoid the transpilation step altogether, React isn't tied to JSX: it's just a library that establishes unidirectional data flow and renders raw data into DOM in an efficient way. I think you are at the point where you still need to do more research and decide if you really need to migrate to React, quite honestly.
    – rm-
    Nov 10 at 14:12










  • There are lots of questions and not a single step by step guide from beginning to production - step by step tutorials are out of scope of SO, There's certain learning curve with React tooling. It's hard to embrace modern JS workflow at once if you don't have enough experience with necessary things (Node, Babel, Webpack).
    – estus
    Nov 10 at 14:35












  • Actualy we do not realy migrate to React now but I see popular tools like jquery wont be able to meet modern needs in the near future. Our mostly used library MooTools came at the end of it's life cycle. I dont think jquery will last too long because ES is able to replace it. A complete migration of our CMS is not possible today. But we want to see how things go with React and try it in a small Module of CMS. That is the idea. I feel integrating React is not a good idea instead of starting from scratch. What do you think?
    – Zortext
    Nov 11 at 9:21














2












2








2







We are planning to switch new technologies like react for my CMS project which is under development for 10 years.



Until now everything was simple and plain on the front end.



First include jquery.js then if necessary include the components and third party scripts, then code and dance with the DOM.



But now while trying to jump into a higher level of technology and different approach, things can easily get very complicated for me.



After spending more than 10 hours with React documents and tutorials I have a very good understanding about what it is and how it works.



But I realized that I am very unfamiliar with some popular concepts. I never used node.js, never used npm, babel, webpack, and may other many "new" things I have seen every where. I am face to face with these tools because of React and I am convinced that these are the inevitable for modern front end development.



Now the question



Our CMS runs on PHP and depends on MooTools heavily at the front end. Instead of a complete rewrite of a 10 years old CMS I just want to try new technologies partially for some cases. Decided to starting with React.



For the case I want to integrate ag-Grid to React also.



What I did not understand is that how to bring all these tools together.



I won't be able to use the simply include js way of react because of ag-Grid.



In the examples the code written has some JSX. Which means that we write JSX and run it translated for the browser to test if it is ok.




  • Each time before testing do I need to translate these files?

  • And more over if the files are translated does debugging become very
    complicated?

  • Can babel make it on the run time? If yes is it a good practice.

  • There are lots of file in the node_modules folder. Which of them
    should I include for production?


All sources on the net are very theoretical and assumes a knowledge. Need some guidance for best practices.



There are lots of questions and not a single step by step guide from beginning to production.










share|improve this question













We are planning to switch new technologies like react for my CMS project which is under development for 10 years.



Until now everything was simple and plain on the front end.



First include jquery.js then if necessary include the components and third party scripts, then code and dance with the DOM.



But now while trying to jump into a higher level of technology and different approach, things can easily get very complicated for me.



After spending more than 10 hours with React documents and tutorials I have a very good understanding about what it is and how it works.



But I realized that I am very unfamiliar with some popular concepts. I never used node.js, never used npm, babel, webpack, and may other many "new" things I have seen every where. I am face to face with these tools because of React and I am convinced that these are the inevitable for modern front end development.



Now the question



Our CMS runs on PHP and depends on MooTools heavily at the front end. Instead of a complete rewrite of a 10 years old CMS I just want to try new technologies partially for some cases. Decided to starting with React.



For the case I want to integrate ag-Grid to React also.



What I did not understand is that how to bring all these tools together.



I won't be able to use the simply include js way of react because of ag-Grid.



In the examples the code written has some JSX. Which means that we write JSX and run it translated for the browser to test if it is ok.




  • Each time before testing do I need to translate these files?

  • And more over if the files are translated does debugging become very
    complicated?

  • Can babel make it on the run time? If yes is it a good practice.

  • There are lots of file in the node_modules folder. Which of them
    should I include for production?


All sources on the net are very theoretical and assumes a knowledge. Need some guidance for best practices.



There are lots of questions and not a single step by step guide from beginning to production.







javascript node.js reactjs babeljs ag-grid-react






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 13:34









Zortext

319




319












  • You may not use JSX syntax at all and avoid the transpilation step altogether, React isn't tied to JSX: it's just a library that establishes unidirectional data flow and renders raw data into DOM in an efficient way. I think you are at the point where you still need to do more research and decide if you really need to migrate to React, quite honestly.
    – rm-
    Nov 10 at 14:12










  • There are lots of questions and not a single step by step guide from beginning to production - step by step tutorials are out of scope of SO, There's certain learning curve with React tooling. It's hard to embrace modern JS workflow at once if you don't have enough experience with necessary things (Node, Babel, Webpack).
    – estus
    Nov 10 at 14:35












  • Actualy we do not realy migrate to React now but I see popular tools like jquery wont be able to meet modern needs in the near future. Our mostly used library MooTools came at the end of it's life cycle. I dont think jquery will last too long because ES is able to replace it. A complete migration of our CMS is not possible today. But we want to see how things go with React and try it in a small Module of CMS. That is the idea. I feel integrating React is not a good idea instead of starting from scratch. What do you think?
    – Zortext
    Nov 11 at 9:21


















  • You may not use JSX syntax at all and avoid the transpilation step altogether, React isn't tied to JSX: it's just a library that establishes unidirectional data flow and renders raw data into DOM in an efficient way. I think you are at the point where you still need to do more research and decide if you really need to migrate to React, quite honestly.
    – rm-
    Nov 10 at 14:12










  • There are lots of questions and not a single step by step guide from beginning to production - step by step tutorials are out of scope of SO, There's certain learning curve with React tooling. It's hard to embrace modern JS workflow at once if you don't have enough experience with necessary things (Node, Babel, Webpack).
    – estus
    Nov 10 at 14:35












  • Actualy we do not realy migrate to React now but I see popular tools like jquery wont be able to meet modern needs in the near future. Our mostly used library MooTools came at the end of it's life cycle. I dont think jquery will last too long because ES is able to replace it. A complete migration of our CMS is not possible today. But we want to see how things go with React and try it in a small Module of CMS. That is the idea. I feel integrating React is not a good idea instead of starting from scratch. What do you think?
    – Zortext
    Nov 11 at 9:21
















You may not use JSX syntax at all and avoid the transpilation step altogether, React isn't tied to JSX: it's just a library that establishes unidirectional data flow and renders raw data into DOM in an efficient way. I think you are at the point where you still need to do more research and decide if you really need to migrate to React, quite honestly.
– rm-
Nov 10 at 14:12




You may not use JSX syntax at all and avoid the transpilation step altogether, React isn't tied to JSX: it's just a library that establishes unidirectional data flow and renders raw data into DOM in an efficient way. I think you are at the point where you still need to do more research and decide if you really need to migrate to React, quite honestly.
– rm-
Nov 10 at 14:12












There are lots of questions and not a single step by step guide from beginning to production - step by step tutorials are out of scope of SO, There's certain learning curve with React tooling. It's hard to embrace modern JS workflow at once if you don't have enough experience with necessary things (Node, Babel, Webpack).
– estus
Nov 10 at 14:35






There are lots of questions and not a single step by step guide from beginning to production - step by step tutorials are out of scope of SO, There's certain learning curve with React tooling. It's hard to embrace modern JS workflow at once if you don't have enough experience with necessary things (Node, Babel, Webpack).
– estus
Nov 10 at 14:35














Actualy we do not realy migrate to React now but I see popular tools like jquery wont be able to meet modern needs in the near future. Our mostly used library MooTools came at the end of it's life cycle. I dont think jquery will last too long because ES is able to replace it. A complete migration of our CMS is not possible today. But we want to see how things go with React and try it in a small Module of CMS. That is the idea. I feel integrating React is not a good idea instead of starting from scratch. What do you think?
– Zortext
Nov 11 at 9:21




Actualy we do not realy migrate to React now but I see popular tools like jquery wont be able to meet modern needs in the near future. Our mostly used library MooTools came at the end of it's life cycle. I dont think jquery will last too long because ES is able to replace it. A complete migration of our CMS is not possible today. But we want to see how things go with React and try it in a small Module of CMS. That is the idea. I feel integrating React is not a good idea instead of starting from scratch. What do you think?
– Zortext
Nov 11 at 9:21












1 Answer
1






active

oldest

votes


















2














JSX is an extension over spec-compliant JavaScript. It is syntactic sugar for React.createElement(...) and is optional in React development.



React can be written in plain ES5:



React.createElement("div", { foo: "foo" });


Instead of JSX:



<div foo="foo" />


Or with helper functions like h that achieve the same goal, e.g. react-hyperscript.



The fact that there is PHP backend application doesn't prevent from developing React frontend application with JSX. This may require to configure React project to not use built-in Express web server and build client-side application to custom location, i.e. existing app's public folder. In case create-react-app is used, this may require to eject the project).




Each time before testing do I need to translate these files?




They should be transpiled to plain JavaScript (ES5 if it targets older browsers). They can be translated on every change in source files when client-side project runs in watch mode (conventionally npm start).




And more over if the files are translated does debugging become very
complicated?




This is what source maps are for.




Can babel make it on the run time? If yes is it a good practice.




It's possible to use Babel at runtime, and this isn't a good practice, even in development environment.




There are lots of file in the node_modules folder. Which of them
should I include for production?




The contents of node_modules doesn't matter. Almost all of them are development dependencies that are needed to build client-side app. This is the task for a bundler, which is Webpack in create-react-app template. It builds project dependencies to plain JS in dist folder.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239490%2fusing-react-with-an-existing-application-with-jsx%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    JSX is an extension over spec-compliant JavaScript. It is syntactic sugar for React.createElement(...) and is optional in React development.



    React can be written in plain ES5:



    React.createElement("div", { foo: "foo" });


    Instead of JSX:



    <div foo="foo" />


    Or with helper functions like h that achieve the same goal, e.g. react-hyperscript.



    The fact that there is PHP backend application doesn't prevent from developing React frontend application with JSX. This may require to configure React project to not use built-in Express web server and build client-side application to custom location, i.e. existing app's public folder. In case create-react-app is used, this may require to eject the project).




    Each time before testing do I need to translate these files?




    They should be transpiled to plain JavaScript (ES5 if it targets older browsers). They can be translated on every change in source files when client-side project runs in watch mode (conventionally npm start).




    And more over if the files are translated does debugging become very
    complicated?




    This is what source maps are for.




    Can babel make it on the run time? If yes is it a good practice.




    It's possible to use Babel at runtime, and this isn't a good practice, even in development environment.




    There are lots of file in the node_modules folder. Which of them
    should I include for production?




    The contents of node_modules doesn't matter. Almost all of them are development dependencies that are needed to build client-side app. This is the task for a bundler, which is Webpack in create-react-app template. It builds project dependencies to plain JS in dist folder.






    share|improve this answer




























      2














      JSX is an extension over spec-compliant JavaScript. It is syntactic sugar for React.createElement(...) and is optional in React development.



      React can be written in plain ES5:



      React.createElement("div", { foo: "foo" });


      Instead of JSX:



      <div foo="foo" />


      Or with helper functions like h that achieve the same goal, e.g. react-hyperscript.



      The fact that there is PHP backend application doesn't prevent from developing React frontend application with JSX. This may require to configure React project to not use built-in Express web server and build client-side application to custom location, i.e. existing app's public folder. In case create-react-app is used, this may require to eject the project).




      Each time before testing do I need to translate these files?




      They should be transpiled to plain JavaScript (ES5 if it targets older browsers). They can be translated on every change in source files when client-side project runs in watch mode (conventionally npm start).




      And more over if the files are translated does debugging become very
      complicated?




      This is what source maps are for.




      Can babel make it on the run time? If yes is it a good practice.




      It's possible to use Babel at runtime, and this isn't a good practice, even in development environment.




      There are lots of file in the node_modules folder. Which of them
      should I include for production?




      The contents of node_modules doesn't matter. Almost all of them are development dependencies that are needed to build client-side app. This is the task for a bundler, which is Webpack in create-react-app template. It builds project dependencies to plain JS in dist folder.






      share|improve this answer


























        2












        2








        2






        JSX is an extension over spec-compliant JavaScript. It is syntactic sugar for React.createElement(...) and is optional in React development.



        React can be written in plain ES5:



        React.createElement("div", { foo: "foo" });


        Instead of JSX:



        <div foo="foo" />


        Or with helper functions like h that achieve the same goal, e.g. react-hyperscript.



        The fact that there is PHP backend application doesn't prevent from developing React frontend application with JSX. This may require to configure React project to not use built-in Express web server and build client-side application to custom location, i.e. existing app's public folder. In case create-react-app is used, this may require to eject the project).




        Each time before testing do I need to translate these files?




        They should be transpiled to plain JavaScript (ES5 if it targets older browsers). They can be translated on every change in source files when client-side project runs in watch mode (conventionally npm start).




        And more over if the files are translated does debugging become very
        complicated?




        This is what source maps are for.




        Can babel make it on the run time? If yes is it a good practice.




        It's possible to use Babel at runtime, and this isn't a good practice, even in development environment.




        There are lots of file in the node_modules folder. Which of them
        should I include for production?




        The contents of node_modules doesn't matter. Almost all of them are development dependencies that are needed to build client-side app. This is the task for a bundler, which is Webpack in create-react-app template. It builds project dependencies to plain JS in dist folder.






        share|improve this answer














        JSX is an extension over spec-compliant JavaScript. It is syntactic sugar for React.createElement(...) and is optional in React development.



        React can be written in plain ES5:



        React.createElement("div", { foo: "foo" });


        Instead of JSX:



        <div foo="foo" />


        Or with helper functions like h that achieve the same goal, e.g. react-hyperscript.



        The fact that there is PHP backend application doesn't prevent from developing React frontend application with JSX. This may require to configure React project to not use built-in Express web server and build client-side application to custom location, i.e. existing app's public folder. In case create-react-app is used, this may require to eject the project).




        Each time before testing do I need to translate these files?




        They should be transpiled to plain JavaScript (ES5 if it targets older browsers). They can be translated on every change in source files when client-side project runs in watch mode (conventionally npm start).




        And more over if the files are translated does debugging become very
        complicated?




        This is what source maps are for.




        Can babel make it on the run time? If yes is it a good practice.




        It's possible to use Babel at runtime, and this isn't a good practice, even in development environment.




        There are lots of file in the node_modules folder. Which of them
        should I include for production?




        The contents of node_modules doesn't matter. Almost all of them are development dependencies that are needed to build client-side app. This is the task for a bundler, which is Webpack in create-react-app template. It builds project dependencies to plain JS in dist folder.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 10 at 14:38

























        answered Nov 10 at 14:30









        estus

        67k2198212




        67k2198212






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239490%2fusing-react-with-an-existing-application-with-jsx%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Schultheiß

            Liste der Kulturdenkmale in Wilsdruff

            Android Play Services Check