K
K
kamelot432020-07-24 10:38:02
React
kamelot43, 2020-07-24 10:38:02

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?
5f1a8fb8757c2870843024.png
5f1a8fc2a7ccc198322931.png
5f1a8fd64e181961481097.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
McBernar, 2020-07-24
@McBernar

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.

T
tervizator, 2020-07-24
@tervizator

Only js extension
In order to connect them, you need to do export first, and after import your components

F
Fedor, 2020-07-24
@Mecitan

If my memory serves me, then you must import your elements for a particular component

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question