DEV Community

Discussion on: Simple React Folder Structure

Collapse
 
crtdaniele profile image
Daniele Carta • Edited

I used this structure:

  • api (fetch with createAsyncThunk - Redux Toolkit)
  • assets (vendors and images)
  • components (all of compontens)
  • helpers (string utils, array utils, constants, ecc)
  • hooks (the custom hooks with the business logic: dispatch to redux, get data, ecc)
  • layout (the wrap components that define the layout of the page)
  • models (typescript interface)
  • slices (createSlice for redux toolkit)
  • store (the store of redux)
  • view (contains the pages of the routing with layout and components)

How to you think about this structure?
All of components are in functional component, and the component in general is only for HTML and for call a custom hooks to get the business logic.

Collapse
 
pcofilada profile image
Patrick Ofilada

I think this is the same as my setup with just additional folders.

Collapse
 
fantasticsoul profile image
幻魂

hey, my dear friend, have you tried concent? that will make state management much easier than u experienced before.

Collapse
 
crtdaniele profile image
Daniele Carta

No, I always used Redux.
Now with Toolkit, Redux is very simple.

In the last month I tried RecoilJS (by Facebook).

Thanks for your advice, I will try to us concetjs!

Thread Thread
 
fantasticsoul profile image
幻魂

big thx, u just need one min to read its quick start and then know how funny it is 😀