I'm planning to do a SPA web app using react redux, I'm stuck at figuring out the right architect for the front end.
So the app can have user to bid product, and admin to approve or manage product. How would the app structure like?
actions
- admin
- user
reducers
- admin
- user
containers
- admin
- user
components
route.js //load admin or user
userStore.js
adminStore.js
Is above structure make sense? route.js will detect role and load relevant route, then in each redux related folder like actions, reducers, store have to have 2 version.
If you are using Webpack you can try multiple src and entry like that:
src-admin
- actions
- reducers
- containers
- components
- ...
- adminRoute.js
- admin.js
src-user
- actions
- reducers
- containers
- components
- ...
- userRoute.js
- user.js
webpack.config.js
and in webpack.config.js:
entry: {
app: ['./src-user/user.js', '.src-admin/admin.js'],
vendors: ['react']
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With