ReactJS Flux Application directory structure -
my team working on large application being written in reactjs using facebook's flux architecture. still in infancy right going grow big soon. have more 50 small component views, plenty of actions, stores , action-creators.
currently, our directory structure looks -
app |___ module_1 | |___ components | | |___ component1.react.js | | |___ component2.react.js | |___ module1actioncreators.js | |___ module1constants.js | |___ module1store.js | |___ module_2 |___ ... (same structure above) one of problems approach module_x folders become increasingly large in number app grows.
does have share how structured app? in our experience, facebook's example apps (todo , chat) have architecture suited small apps once stores, components , actions grow in number, becomes harder manage.
thanks in advance.
the usual directory structure more this:
js ├── appbootstrap.js ├── appconstants.js ├── appdispatcher.js ├── actions │ ├── appactions.js │ ├── friendactions.js │ └── photoactions.js ├── components │ ├── approot.react.js │ ├── friends │ │ ├── friend.react.js │ │ ├── friendlist.react.js │ │ └── friendsection.react.js // querying-view, aka controller-view │ └── photos │ ├── photo.react.js │ ├── photocategorycard.react.js │ ├── photocategorycardtitle.react.js │ ├── photogrid.react.js │ └── photosection.react.js // querying-view ├── stores │ ├── friendstore.js │ ├── photostore.js │ └── __tests__ │ ├── friendstore-test.js │ └── photostore-test.js └── utils ├── appwebapiutils.js ├── fooutils.js └── __tests__ ├── appwebapiutils-test.js └── fooutils-test.js
the css directory looks mirror of components directory, 1 css file per component. folks these days prefer of styling inline on component, however.
don't overthink -- there not 1:1 between stores , querying-view or "section", there in example.
and need right app. not dogma. data flow stuff, inversion of control , decoupling of stores -- these more important ideas how organize files.
The topic **“ReactJS Flux Application Directory Structure”** explains how to organize a ReactJS application using the **Flux architecture**, which separates the application into different parts to make data flow predictable and code easier to maintain.ReactJS Course in Chennai. A typical structure contains **components** for UI elements, **actions** for triggering events, **stores** for managing application state, and **dispatcher** for distributing actions to the appropriate stores. It may also contain folders for **constants, utilities, services, and assets**. The basic data flow is **View/Component → Action → Dispatcher → Store → View**, helping developers manage state changes in a clear and structured way, especially in larger React applications.
ReplyDelete