Whole table is re-rendered when subcomponent is updated
See original GitHub issueWhat version of React-Table are you using?
6.7.4
What bug are you experiencing, or what feature are you proposing?
We implemented a subcomponent based on a mapper in a react redux environment.
First we have a Dashboard component (not connected to Redux store)
export default class Dashboard extends Component {
render() {
const data = this.props.data;
const period = this.props.period;
const columns = this.props.columns;
const subComponentMapper = row => {
return (
<div>
<DashboardSubComponents
period={period}
diplayedIn={row}
/>
</div>
);
};
return (
<div className="dashboard-container">
<ReactTable
noDataText="Veuillez patienter pendant le chargement des données..."
data={data}
columns={columns}
defaultPageSize={10}
className="-striped -highlight"
SubComponent={subComponentMapper}
maxLength
/>
<br/>
</div>
);
}
}
DashboardSubComponents are (when going deeper into implementation) finally some containers containing components. They are to be updated with the redux store in this way:
- We click on the arrow to unfold the line
- In the didMont function, some API call is made
- When the API call is over (dispatch with thunk), the redux store is updated and we want our subcomponent to read props from it.
The problem is:
1- data={data} is NOT linked to the part of the state that is updated by the API call in the subComponents 2 - BUT the whole table is re-rendered, leading to our subcomponent not to show.
My question is thus: is this a wanted behaviour ? Does the whole table is re-rendered when a subcomponent is changed ?
Thanks in advance, I just want to know this before invastigating too much redux-related magic.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Whole table is re-rendered when subcomponent is updated
We implemented a subcomponent based on a mapper in a react redux ... Whole table is re-rendered when subcomponent is updated #649.
Read more >Re-rendering Table component when parent passes new or ...
Although the parent component fetches the new data and rerenders, the Table Component does not update to show the new data in the...
Read more >When does React re-render components? - Felix Gerschau
Force a React component to rerender. Using React's forceUpdate function; Force an update in React hooks. How to optimize re-renders.
Read more >Improving component's re-render performance | Dimitrios Lytras
We map over this array in order to render a table. Component.tsx ... Each row of the table is a component that holds...
Read more >Learn how to force react components to rerender without ...
A complete guide on component re-rendering. Here you will learn how to force react components to rerender without calling the set state.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@gary-menzel we solved this using, as you suggested:
Thanks for you help, closing !
This is the default behaviour. Look at the
collapse,,,,
set of props in the doco to control this.