score:1
Accepted answer
you need to use state and useeffect
import {usestate,useeffect} from 'react'
export default function app() {
const[logedstatus,setlogedstatus])usestate(false)
useeffect(()=>{
let mounted=true;
asyncstorage.getitem('logedin').then(logedin =>{
if(mounted) setlogedstatus(logedin)
})
return()=>{mounted=false;}
},[])
return (
<provider store={store}>
{logedstatus.length === 0 ? <navigator /> : <logedinnav/>}
<snackbar />
</provider>
);
}
Source: stackoverflow.com
Related Query
- React native asyncstorage not working properly
- onclick function is not working in react native application
- Scroll View inside view not working react native
- React native textDecoration properties not working on Android
- TouchableOpacity and button not working in react native Modal?
- React native vector icon not working on current version 0.60
- Custom font not working in React Native
- React Native Image Not Working with specific URL
- React Native Text color not working
- React Native FlatList horizontal mode not working at all
- Paste from clipboard not working with React Native on iOS simulator
- React Native 0.60.3 babel-plugin-transform-remove-console not working
- <TextInput keyboardType="numeric"/> is not working in react native
- Marker click event on react native maps not working in react ios
- Nested Text, Vertical Align not working - React Native
- flexWrap not working for <Text> element in React Native
- Keydown/up events with React Hooks not working properly
- React Native Modal Transparent Not Working
- React Native ScrollView scrollTo function is not working
- react native button style not working
- React Native "onViewableItemsChanged" not working while scrolling on dynamic data
- React Native svg clip path on image not working
- React Native localeCompare not working on Android
- Alert prompt to function not working in react native
- React router goBack() not working properly
- React PropTypes validation for arrayOf required elements not working properly
- React Native nextFocusRight Prop on an TouchableOpacity is not working
- Shake gesture not working on physical device with react native
- React Native + Expo + Axios file upload not working because axios is not sending the form data to the server
- transitionConfig is not working in react native
More Query from same tag
- Can't set up the HMR: stuck with "Waiting for update signal from WDS..." in console
- Extra await in react breaks async tests
- how to assign each block an Id to differentiate between blocks inside a canvas and fetch data according to that id
- Dispatch 2 actions in redux thunk
- Same File Styles in ReactJS (similar to VueJS)
- How to map a 2d array in React Js
- How can I use morris.js in React.js?
- ReactJS: Reload a new instance of the component?
- Redirecting during fetch epic with redux-observables and RxJS
- how to resolve typescript error ts2339: property 'yyy' does not exist on type 'intrinsicattributes & ...?
- How to load state from local storage before mounting the component in React.js?
- How to avoid wrapping ClassNames【Gutenberg RichText】
- Multiple Redux states in a single component - Typescript, React, Redux
- React.js: POSTMapping fetch from JavaSpring-boot backend sends request, but does nothing
- Sticky bottom and top react
- origin has been blocked by CORS policy Spring boot and React
- Next.JS useRouter will only returns an empty object for a dynamic route
- Highlight lines in React CodeMirror
- React Bootstrap hide/show eye icon
- How can I grab a value from a Redux store from outside of a component?
- React Redux dispatch action after another action
- Not Sure How to Start and Deploy ReactJS App on Production Server with ExpressJS
- some of the image not showing up when I use if statement react.js
- How to use map on an array of objects
- solve:Expected an assignment or function call and instead saw an expression no-unused-expressions
- React-Admin Simple Refresh JWT Token
- Where to put chained actions in React/Redux
- React js css class background image not visible
- how to add Row Span in dynamic Json Table React JS and table cell data comparison
- How to create a wrapper for an Apollo query that uses React hooks