我正在为我的本机应用程序的文件夹结构而苦苦挣扎。我的应用程序是一个简单的表单应用程序,不使用 redux。我的文件夹结构如下:
App.js
index.js
package.json
是的,我没有添加任何文件......我在谷歌上搜索,但我只找到了带有 redux 的文件夹结构。我几乎所有的代码都是用 App.js 编写的,但我认为它变得有点复杂。我想知道从 App.js 移动逻辑的位置。
我的 App.js 是这样的:
some import codes here
export default class App extends Component{
super()
this.state={//init state}
initState(){
//initialize state
//this is called when the submit button is pushed
}
onPress(){
//this function is called when the submit button is pushed
}
render(){
return(
//a lot of inputs here like id, name, email, date, comment...
//I think I can divide these inputs as components
)
}
const styles = StyleSheet.create({
//style sheets here
})
}
我想知道
谢谢。
我曾在有或没有 redux 的情况下开发过几个具有不同文件夹结构的应用程序。但我发现这种文件夹结构非常有用。这种结构也有助于大规模应用程序以及小规模应用程序。
Fractal — 无限规模的反应应用程序结构
https://hackernoon.com/fractal-a-react-app-structure-for-infinite-scale-4dab943092af
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句