React native 反应效果提高';create不是一个函数';错误

React native 反应效果提高';create不是一个函数';错误,react-native,use-effect,React Native,Use Effect,我有以下React本机模块: import React, {useContext, useEffect} from 'react'; import {Image, StyleSheet} from 'react-native'; import AsyncStorage from '@react-native-community/async-storage'; import AuthContext from '../context/auth/authContext'; const Intro =

我有以下React本机模块:

import React, {useContext, useEffect} from 'react';
import {Image, StyleSheet} from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import AuthContext from '../context/auth/authContext';

const Intro = () => {
  const getLocalUser = async () => {
    try {
      const value = await AsyncStorage.getItem('user');
      return value;
    } catch (error) {
      console.log(error);
    }
  };
  const localUser = getLocalUser();

  const {setUser} = useContext(AuthContext);
  
  useEffect(() => {
    setUser({localUser});
  }, []);

  return (
    <Image
      style={styles.image}
      source={require('../static/logo_intro.png')}
    />
  );
}

const styles = StyleSheet.create({
  image: {
    width: 430,
    resizeMode: 'center',
    paddingTop: 500
  }
})

export default Intro;
import React,{useContext,useffect}来自“React”;
从“react native”导入{Image,StyleSheet};
从“@react native community/async storage”导入异步存储;
从“../context/auth/AuthContext”导入AuthContext;
常量简介=()=>{
const getLocalUser=async()=>{
试一试{
const value=await AsyncStorage.getItem('user');
返回值;
}捕获(错误){
console.log(错误);
}
};
const localUser=getLocalUser();
const{setUser}=useContext(AuthContext);
useffect(()=>{
setUser({localUser});
}, []);
返回(
);
}
const styles=StyleSheet.create({
图片:{
宽度:430,
resizeMode:'中心',
加油站:500
}
})
导出默认简介;
这会引发以下错误:
[Tue Sep 08 2020 15:00:47.220]错误类型错误:create不是函数。(在“create()”中,“create”未定义)


我检查了,但我已经在做了。

可能是您必须使用
useState
而不是
useffect

请参阅,了解此错误以这种方式显示的原因