Is there any way to render fushion charts on server side in react ? . I am getting this ReferenceError: document is not defined error when starting the react app via express server.
I am guessing here, but if you are using a charting library which relies on functionality only present on the client, for instance window, you could do a simple check if the component has actually mounted. There are many ways of doing this. If you are writing a functional component, you could for instance do:
const [isClient, setIsClient] = useState(false);
useEffect(() => {
setIsClient(true);
}, [])
return isClient ? (<SomeFusionChart/>) : (<SomePlaceHolder/>
within the functional component, or separate this into a custom hook.
You could also do
(typeof window !== 'undefined') ? (<SomeFusionChart/>) : (<SomePlaceHolder/>