-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error using ReactDiffView in Remix App #43
Comments
i think your data might be an object, supposedly either sourceVersion or newVersion, |
@ObaidAshiq I have updated it to remove the curly braces, but it still doesn't work import ReactDiffViewer from "react-diff-viewer-continued";
export const DiffExpandView = () => {
return (
<>
<ReactDiffViewer
oldValue="source Version" <-- removed curly braces
newValue="new Version" <-- removed curly braces
splitView={true}
// linesOffset={5}
/>
</>
);
} |
I assume it has something to do with SSR somehow, but not quite sure what that would be. I'll have to boot it in a Remix app to see what effect it has. |
This also happens with a basic InertiaJS + Vite using SSR https://inertia-rails.netlify.app/guide/. The component fails during SSR, and then renders correctly on the client. Pretty tired at the moment to create a basic reproduction app, but hoping to do one soon. |
Somehow browser and node is loading module differently. In node(server), if I print
I get
but in browser
|
I fixed my issue by doing: import RDV from 'react-diff-viewer-continued'
let ReactDiffViewer
if(typeof window == 'undefined') ReactDiffViewer = RDV.default
else ReactDiffViewer = RDV |
how to fix? |
Summary
I am running into an error when trying to use this library
Here is the error I get:
Context
I am working with a remix-react app.
Any idea how to fix this? This component would really fit my current needs so I would love to be able to use it
The text was updated successfully, but these errors were encountered: