Skip to content

Error: Objects are not valid as a React child (found: object with keys {_40, _65, _55, _72}). – React Native error – How to fix?

When I created a new React Native component, I wanted to use it asynchronously.

export const DateTimeTool = async () => {
  
}

This is not supported in React Native as when you use this component in another component it wouldn’t get resolved. Instead you can create methods inside this component and define async functions.

export const DateTimeTool = async () => {
  
    const onChange = async(event, selectedDate) => {
    const currentDate = selectedDate || date;
    setShow(Platform.OS === 'ios');
        setDate(currentDate);
    console.log("New date and time -- " + selectedDate);
    await AsyncStorage.setItem('mockTime', selectedDate.toString());
  }};

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.