没有redux的react native app的文件夹结构

我正在为我的本机应用程序的文件夹结构而苦苦挣扎。我的应用程序是一个简单的表单应用程序,不使用 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
 })
}

我想知道

  • 在哪里放置我的“onPress”或“initState”或其他一些功能。
  • 如何将简单的表单输入划分为组件
  • 我是否可以从 App.js 中删除样式表以及将它们放在哪里

谢谢。

杰拉吉·乔杜里

我曾在有或没有 redux 的情况下开发过几个具有不同文件夹结构的应用程序。但我发现这种文件夹结构非常有用。这种结构也有助于大规模应用程序以及小规模应用程序。

Fractal — 无限规模的反应应用程序结构

https://hackernoon.com/fractal-a-react-app-structure-for-infinite-scale-4dab943092af

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

React Native 错误:RNHTMLtoPDF 错误:无法创建文件夹结构

如何在realm-react-native中创建嵌套的类似于文件夹的结构?

从React Native从共享文件夹导入

React-Native 导航文件夹

无法从React Native App中的项目文件夹导入.js文件

是否可以运行没有节点模块文件夹的React Native项目

我没有 android 和 ios 文件夹-react native

有结构文件夹

使用React Native构建两个孪生应用程序的最佳文件夹结构是什么?

使用@访问React Native中的某些文件夹

当前文件夹中的react-native init

React-Native 不导入文件夹

减少 react native ios/android 大小文件夹

React 组件文件夹结构

React Redux应用程序文件夹结构

在 Github 上创建-react-app 奇怪的文件夹结构

有没有办法让我在 React Native 中创建一个文件夹并将 JSON 文件放在 Android 和 iOS 的移动本地存储中?

React native:安装react-native-maps后不存在android文件夹

React Native组件没有从Redux获取this.props.dispatch

React Native - Redux ~ 没有被调用时更新道具

从具有指定文件夹名称的文件夹结构中获取文件名

在没有iPhone的Windows 8上创建React Native App

App Center没有显示React Native Android的构建版本

在React Native中的Redux在Redux中没有React导航状态

如何从react-native中的Assets文件夹中读取文件?

如何从React Native ios项目中的components文件夹访问js文件

React-native Google Drive如何获取文件和文件夹列表

React Native:有什么方法可以检查文件是否存在于android_asset文件夹中?

如何在没有子文件夹的情况下复制任何文件夹结构