Refresh previous screen on goBack()

Adding an Api Call in a focus callBack in the screen you’re returning to solves the issue. componentDidMount() { this.props.fetchData(); this.willFocusSubscription = this.props.navigation.addListener( ‘willFocus’, () => { this.props.fetchData(); } ); } componentWillUnmount() { this.willFocusSubscription.remove(); } UPDATE 2023: willFocus event was renamed to focus componentDidMount() { this.props.fetchData(); this.focusSubscription = this.props.navigation.addListener( ‘focus’, () => { this.props.fetchData(); } … Read more

How to get query parameters in react-router v4

The ability to parse query strings was taken out of V4 because there have been requests over the years to support different implementation. With that, the team decided it would be best for users to decide what that implementation looks like. We recommend importing a query string lib. Here’s one that I use const queryString … Read more

is there a way to set a default route with React-Router v6

If I understand your question about a “default” route correctly then I am interpreting this as one of the following: Use an index route: You can wrap a set of routes in a layout route and specify an index route: <Routes> <Route path=”/*”> <Route index element={<ComponentA />} /> <Route path=”pathB” element={<ComponentB />} /> <Route path=”pathC” … Read more

tech