Answer the question
In order to leave comments, you need to log in
How to code with ReactJS?
Hello,
For a long time I was engaged in classic layout (10 static html pages, a template engine, a preprocessor, a sheet in custom.js)
I decided to use React, and the first problem I encountered, all the documentation / videos come down to:
ReactDOM.render( <Content/> ,
document.getElementById('root')
);
ReactDOM.render( <Footer/> ,
document.getElementById('footer')
);
Answer the question
In order to leave comments, you need to log in
The essence of React is that its architecture is based on components. As in Lego, everything is assembled from bricks.
Next, the top-level component is rendered to some element on the page. Different components can be rendered into different elements, no one forbids this.
You also need to clearly understand that the philosophy of React is to generate markup dynamically when the state (state) changes. Classically, the state is stored locally in each component, but this is often inconvenient, so they came up with Flux, one of the incarnations of which is, to some extent, Redux - a kind of centralized state storage, with buns and ballerinas.
As far as I know, React does not impose any paradigms and coexists perfectly on the same page with anything, so, in principle, you can only edit the most necessary things, and file the rest the old fashioned way...
>> or static information (which does not make sense to pass through js)
For such situations, a component is usually created <StaticInformation page="page1" />
, in which, for example, using componentDidMount(), a div is filled with information received using a post/get request.
>> tutorials where more extensive architecture is covered than in SPA tutorials
https://www.youtube.com/watch?v=MhkGQAoc7bc&list=P... - the most adequate tutorials
>> For a situation when you need to render two components in different places on the page
Initially, the parent component App extends React.Component is created (for example), in which in the render method we have:
<section>
<Header />
<Content />
<Footer />
</section>
React is needed to develop SPA applications. For your case with three pages, it is not needed. Don't waste your time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question