我对React本地人不熟悉.在启动之前我已经完成了很多教程.我正在尝试在我的应用程序中创建商店,可以在需要时通过应用程序的屏幕访问.
这是我的文件结构.
index.ios.js
import { AppRegistry } from 'react-native';
import App from './app/index';
AppRegistry.registerComponent('AwesomeProject', () => App);
Run Code Online (Sandbox Code Playgroud)
/app/index.js
import React, { Component} from 'react';
import {
Text,
View,
} from 'react-native';
import userStore from './store/userStore';
import ViewBackground from './components/ViewBackground';
class App extends Component {
constructor(props){
super(props);
this.isLoggedIn = true;
}
componentDidMount() {
this.fetchUsers().done();
}
async fetchUsers(){
console.log('Before User Fetch');
var result = await userStore.getAllUsers();
console.log('After User Fetch');
}
render() {
if(this.isLoggedIn){
return this.loggedInView();
}else{
return this.loggedOutView(); …Run Code Online (Sandbox Code Playgroud)