Structure
Here is what the structure for a blog built with Trux might look like:
stores/
models/
User.js
Post.js
Comment.js
index.js
collections/
Users.js
Posts.js
Comments.js
index.js
index.js
components/
connectors/
index.js
User.js
Users.js
Post.js
Posts.js
Comment.js
Comments.js
nodes/
User/
Name.js
Bio.js
List.js
Post/
Title.js
Body.js
Date.js
Form.js
List.js
Comment/
Body.js
Date.js
Form.js
List.js
ProfilePic.js
Header.js
Footer.js
App.js
index.js
Some notes about this structure:
components
is where all your components should sit, we break them down into categories within this directorycomponents/connectors
is where any component that needs to receive store updates should exist. Theindex.js
file here should export all your connectors.components/nodes
is where any component that receives store data as props should sit. Theindex.js
file here should export all your nodesstores/models/index.js
is yourmodels
module and should export all model classesstores/collections/index.js
is yourcollections
module and should export all collection classesstores/index.js
is your stores module it should export instantiated stores