score:0
you have two options, use redux, or show/hide components based on tabs.
heres an example to show/hide components
{this.state.showaboutme ? <aboutmecomponent navigation={this.props.navigation} props={this.props.user} /> : undefined}
score:1
personally, i chose to ditch react-router in this case and create a parent component with a state containing the current tab to display, while only displaying the active one.
here's a very simple example
<div
style={{display: this.state.currenttab === 'component_a' ? 'block' : 'none'}}
>
<componenta />
</div>
<div
style={{display: this.state.currenttab === 'component_b' ? 'block' : 'none'}}
>
<componentb />
</div>
Source: stackoverflow.com
Related Query
- How to maintain state between routes with React Router?
- How to share application State between React Router v4 routes
- How to communicate UI state changes between React components with Redux?
- How to sync React Router Params with state
- How Mapping Routes in React Router with Protected Function?
- How to use router for switching between components with a key value pair in react
- How to transfer state between React components with hooks?
- Protected Routes React Router 4 not working with auth state stored in Redux
- How do I nest routes with React router
- How to route correctly with a mixture of parent and child routes with React Router
- react router 4 - how to make a root path with nested routes but fallback to not-found
- React with Ant Design - How to share state between multiple <Select> on a <Form>?
- How to link to Routes inside the component rendered by another Route with React Router
- React Router v6 - how to handle nested routes but with only current page showing instead of previous pages
- How to propery genearate routes with approperiate component with React Router
- Can't figure out how to Link state with React Router
- How to make redirect in nested routes with React Router
- How do i wrap 2 Routes with a context in React router v6
- How do i make a toggle save its state between React Routes
- How to override Express API routes with React Router
- How to manage state between React router and redux
- How can I maintain state and "this" with react component functions
- How to add react router Error together with private routes
- How to add Nested and Non-Nested Routes with React Router - ReactJS?
- How to do nested routes with react router 4?
- how do i save state when open lik in new tap with react router dom
- How to stop remounts and avoid having to lift state with React Router 5 and <Switch>?
- How should I be handling query routes with react router v4?
- Nested routes with react router v4 / v5
- How to implement authenticated routes in React Router 4?
More Query from same tag
- Text disappears after reaching the required length
- Set an authenticated user's email as a variable name
- React Redux connect() with Redux thunk
- React twice mount component, but on second time doesn't receive props
- Enable auto (self)-closing tags for JSX in MDX file
- React Hooks useState() with an Array of Object
- Can't override mui checkbox or radio buttons
- How can I take a input from user and change it with setState?
- Rendering a part of component through function in react JS
- React Redux will not reset store of some component
- Can't perform a React state update on an unmounted component. Other solutions not working
- How to change color for the numbers based on its value using javascript and react?
- React-rails Cannot Find App Component in View
- Dispatching a Redux Thunk action outside of a React component with TypeScript
- Form submission in React
- No pem found for envelope: {"alg":"RS256","kid":"5a66482db3800c83c63","typ":"JWT"}
- getting error this.node(...) is null using react?
- Warning: Each child in a list should have a unique "key" prop. Error With Nested For Loop Components
- How do I load API data into input value property on page load from React State?
- Put two backgroundcolor on two lines only
- React + Foundation - Render Modal with different props on click
- React - How to update my component when there is a change on the server
- How to add constant inside Joi validator?
- react markdown type for paragraph renderer?
- React native styling. width: percentage - number
- Update item in objects array based on object property
- How can I disable/enable a button depending on an Input Form on React?
- Should I use useRef or lift state up to deal with the following case?
- React Validation Max Range Using Formik
- How to fix the peer dependencies Installation problem