[Question] onChange infinite rerendering #377
federicoverly
started this conversation in
General
Replies: 3 comments
-
Hi @federicoverly, If you use "onModeChange", your problem will be sorted out. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@federicoverly Did you manage to solve the infinite rendering with the OnModeChange? I'm facing the same issue. I solved it partially with the OnModeChange, but not all the problem. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm currently using: onChange={data => {
if (JSON.stringify(data) !== JSON.stringify(this.state.data)) {
this.setState({ data });
}
}} But I guess it was a mistake to consider this library for a production use, despite it having so many stars. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi community!
I recently added react-spreadsheet to my project and was trying to prepare a spreadsheet that can be modified by the user to later save it, export ir or something.
I have followed the docs, however, the onChange={setData} generes an infinite loop of re-rendering.
The code is exactly this one:
const [data, setData] = useState([ [{ value: "Vanilla" }, { value: "Chocolate" }, { value: "" }], [{ value: "Strawberry" }, { value: "Cookies" }, { value: "" }], ]); return <Spreadsheet data={data} onChange={setData} />;
Any ideas why this is happening?
Beta Was this translation helpful? Give feedback.
All reactions