Last active
July 29, 2016 07:03
-
-
Save LiuuY/ac286f68e0e4c11a76ca4404c39da2ed to your computer and use it in GitHub Desktop.
Code Structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
现阶段的代码组织结构是依据代码的类型: | |
例如action文件夹、pages文件夹等等,但是这样不利于代码的重用,因为一个模块,包含redux相关,css,jsx等等,分布在不同的文件夹里面: | |
asssets | |
|- css | |
|- actions | |
| - login.js | |
|- reducers | |
| - login.js | |
|- pages | |
| - login | |
| - index.jsx | |
|- utils | |
| - index.js | |
拷贝一个模块需要到多个目录。如果将代码按照功能模块组织例如: | |
assets | |
|- login | |
| - style.css | |
| - action.js | |
| - reducer.js | |
| - index.jsx | |
| - utils.js | |
这样当其他项目需要login的时候就只需要拷贝这个文件就可以了,而且编写模块的时候也只需要在一个文件夹下工作。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment