W
W
webe2018-06-21 22:52:06
React
webe, 2018-06-21 22:52:06

React project structure?

Let 's say this project:
https://github.com/Rhymond/product-compare-react/t...
Imagine that you need to create a header in the project, and in the header we will have a phone, various widgets for calls and a trash button., i.e. a bunch of vsgeo
Where would you insert the header component and everything you need for it?
my version:
In Components we create a folder Header
Inside the folder Header we create folders:
1) Phone
2) Cart
3) Logo
Or is it better not to make Phone Cart Logo so deep, but put it in Components? (it's really a cant, why put it in Components, if we use these components only in the header)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2018-06-22
@webe

In components/header + nesting, everything is as you described in the question.
There are different approaches to organizing the structure, I like the approach by features (more difficult) or the stupid division into containers / components and that's it (easier, but a dump, suitable for starting to study). people who completed the second test task (video and text)
also had different approaches to organization . There are repositories in the comments of the video, you can check it out.

S
Sergiu Mitu, 2018-06-22
@EaGames

Inside the Header folder we create folders:
1) Phone
2) Cart
3) Logo

only inside the Header you can create 1.3 components right away, since by name there is something very simple and does not need a folder.
Cart may need to be divided into CartDropdown, etc., so we put it in a folder.
But it's all purely subjective, everyone does it differently.
I also met this: It's
quite understandable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question