Table do not rerender after data change. When I update data second time, it works.
See original GitHub issueI have data coming in as a prop like below. I usually click a button in the parent component to change the prop in the Performancetbl component. But when i click on the button once, table is not rerendering with new data. When I click on it one more time, it rerenders though. Why is that happening?
I tried to save props into a state variable state in Performancetbl component, but that did not change the behavior at all.
I also tried console.log(props.datas) to see if correct data is appearing the first time I click on the button. And it is indeed the correct value! Can you guys figure out why this is happening?
function Performancetbl(props) {
const options = {
...
};
console.log(props.datas)
return(
<div style={{ maxWidth: "100%" }}>
<MaterialTable
title="Overall"
data={props.datas}
columns={props.columns}
options={options}
components={props.components}
/>
</div>
);
}
export default Performancetbl;
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:14
Top Results From Across the Web
How to re-render react-table in .js when data changes ...
The following code below does NOT re-render, however console says that the context.data.exactval value is updated. const context = useContext( ...
Read more >How to Update Data Without Rerendering an Entire Grid in ...
With immutable mode in our Syncfusion Angular Data Grid, you can easily update records without rerendering the entire grid component.
Read more >React re-renders guide: everything, all at once
Comprehensive guide on React re-renders. The guide explains what are re-renders, what is necessary and unnecessary re-render, what can ...
Read more >Data refresh in Power BI
Because Power BI copies the data, you must refresh the dataset to fetch changes from the underlying data sources. When a dataset is...
Read more >Re-rendering Components in ReactJS
A second or subsequent render to update the state is called as re-rendering. React components automatically re-render whenever there is a ...
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
^ you were really fast in replying. I saw your other live demo and figured out the solution. Thanks man. Also, using stateprovider from ‘Unstated-Next’ works really well with this table. Simpler version inside Try—>
@Sheing I wouldn’t expect that to update the data… you have to update the state/data yourself…
Live demo here