Saturday 31 July 2021

How do I gracefully prevent crashes in react native?

I would like to gracefully show an empty View when any error occurs (syntax, undefined, type errors, etc.)

This is what I've tried, but it doesn't seem to fail gracefully. The whole app still crashes with this implementation.

const Parent = (props) => {
    try{
        return (<Child/>) //if Child logic crashes for any reason,  return a blank view.
    }catch(err){
        return <View/>
    }
}


from How do I gracefully prevent crashes in react native?

No comments:

Post a Comment