Answer the question
In order to leave comments, you need to log in
How to use React components with plugins and jQuery modules?
Tired of the sheet and the incomprehensibility of the JS code when developing sites, for this reason I decided to use a modular approach in development. I also chose React with React Habitat for the ability to include react components on a regular web page that is rendered using php.
In the process, the following question arose:
Since the page is not represented by one react component, but only includes them in places, there are many elements rendered using php that need some kind of user interaction (hide/show hidden text, use some jquery plugin to example for rewinding the page and others). Since this DOM is not generated using react, I understand that I can use jQuery to interact with it?
Components for React are described in separate files, which are later collected into one. How to deal with jQuery in this case? Write commonJS modules? What if it's a simple hide/show text? also a separate module? At this point, I'm swimming a little.
Please advise how to deal with the above situation.
Answer the question
In order to leave comments, you need to log in
Well, look how it's done here https://gist.github.com/avakhov/7b9d2b1a354e59dbfa63. In general, what prevents the rendered php blocks from connecting a separate file with scripts? It would be logical. React components separately, jquery separately.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question