score:3
Accepted answer
from the docs:
when you use component (instead of render or children, below) the router uses react.createelement to create a new react element from the given component. that means if you provide an inline function to the component prop, you would create a new component every render. this results in the existing component unmounting and the new component mounting instead of just updating the existing component. when using an inline function for inline rendering, use the render or the children prop.
instead what you can do is to use render
function:
<route
path={`${this.props.match.path}/player_list`}
render={props => (
<playerlist {...props} basepath={this.props.match.path} />
)}
/>
Source: stackoverflow.com
Related Query
- React child routes remounting on click
- How to handle click events on child components in React.js, is there a React "way"?
- React router - pass props on routes to child components
- Adding a click handler to React children for methods on the child component
- React router nested routes. Not rendering child routes
- React router activeClassName doesnt set active class for child routes
- React router redux fetch resources if needed on child routes
- Passing button click from child to parent in React
- React + React-router -> Child routes best organization?
- Hiding parent react component, when you click on a child component
- Do react render props cause remounting of the child components?
- React unit testing -> simulate click on child to invoke method
- React - How to prevent click event from child component
- Click on child component React Typescript not working
- Embedded child component doesn't get changed when I click a new one with React Router
- Navigate from parent to child in react where each component defines its own routes
- Can't print child components of nested routes on React Router v5
- Trigger Google Optimize experiment or any tag on click event in child or parent component, Application is build on Meteor React Redux
- react child component doesn't respond to click event
- How to route correctly with a mixture of parent and child routes with React Router
- React router v6 nested routes not displaying child element
- How to define child routes as react components in react-router?
- How to detect if child is clicked on parent click React
- How to set focus on child component's input on a button click in the parent in React Hooks
- React js - How to get Click event values from child component to parent component?
- How to fire a setState function in react from child componenet to parent componenet with data from a button click
- Unmount component on click in child component button // React
- Change the state of parent component on click of a child component with a specific key in React JS
- React click handler passed to child component is not working
- React Conditional Rendering child on click not working
More Query from same tag
- Show a react-placeholder skeleton until a image loaded completely in a page
- React Component not working with ES6
- How to update variables in a React-Hooks Apollo polling?
- Redux converting functions to objects
- Display user's GitHub repositories in React App
- Data from react-hook-form
- React Table usePagination not applying pagination
- re-rendering issue using react hooks
- (React.js + Hooks) How to reset input field after button click?
- How to open a specific popup on map load?
- Form element goes blank when I dispatchEvent()
- React.Children.only expected to receive a single React element child with <Link > component
- Null useState issue when state is not null in useEffect
- Self-hosted fonts in Next.js with next-less
- Call Azure AD protected API from React
- Reactjs: Issue while updating context API shared by multiple components
- how to spy on window.location functions?
- Reset a specific Input field on ant design form
- image upload using multer, reactjs, nodejs
- Async function doesn't return in React app
- Importing a bunch of files in react js at a go
- How can I test a HOC on jest?
- React Router - Nested links redirecting to custom 404 page
- Material UI: Parsing error: Identifier 'Switch' has already been declared
- Incorrect casing error with dynamically rendered component in React
- ReactDOM is not rendering the code that is passed to the root
- Filter Array by Multiple Criteria
- How can we use useEffect for multiple props value changes
- Redux does not send to the store 2 properties at a time
- Can't get data from firebase in react chart