Answer the question
In order to leave comments, you need to log in
How to assemble a page from react components?
I have a project which I created with create react app. I have prepared react-components - folded blocks, separate ui / ux components that are reused in other blocks. Now the task is to assemble pages / pages from ready-made blocks. now in the root of the project I have index.js, which connects the App component. If, for example, I want to create two/three html pages, how can I connect my react components to them? Should my pages only have a js extension or is html allowed?
Answer the question
In order to leave comments, you need to log in
Export your components from files, import them into your pages.
Create a pages folder, create exactly the same component there as the others, import the necessary one there and arrange the layout. For meta tags, you can use react-helmet. For react-router routing.
A page is no different from a component.
Only js extension
In order to connect them, you need to do export first, and after import your components
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question