Skip to content
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

SSR support #16

Open
mkdynamic opened this issue Sep 21, 2023 · 1 comment
Open

SSR support #16

mkdynamic opened this issue Sep 21, 2023 · 1 comment

Comments

@mkdynamic
Copy link

When rendering the component server side with React 18 I get:

Error: Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.
@jaywcjlove
Copy link
Member

@mkdynamic nextjs example: https://stackblitz.com/edit/stackblitz-starters-elrztl?file=app%2FJSON.tsx

'use client';
import JsonView from '@uiw/react-json-view';
import { nordTheme } from '@uiw/react-json-view/nord';

const avatar = 'https://i.imgur.com/MK3eW3As.jpg';
const longArray = new Array(1000).fill(1);
const example = {
  avatar,
  string: 'Lorem ipsum dolor sit amet',
  integer: 42,
  float: 114.514,
  bigint: BigInt(1000),
  longArray,
  string_number: '1234',
};

export default function JSONDemo() {
  return <JsonView value={example} style={nordTheme} />;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants