react-class-based-component

Moving external library from Class-based to Functional Component in React

夙愿已清 提交于 2021-02-10 14:46:34
问题 I'm using the JExcel javascript library with React. The documentation outlines the approach with Components, but makes use of ReactDOM.findDOMNode() which I believe has been deprecated. I've tried moving it to a functional component, but whilst it does ostensibly work, there is an issue, in that the React component using the class re-renders about 5 times... and each re-render causes the JExcel element to add another sheet! Here's the original example code: import React from "react"; import