We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Add option to generated react libraries with disabled SSR in React
Generated components should be able to omit SSR phase of rendering in multiple react ssr frameworks like Next.js, Remix and other
Wrap every component in "no SSR" component when flag is enabled
Using https://github.com/kadirahq/react-no-ssr when consuming component or add such wrapper into every project
You can easily disable SSR using componentDidMount/useEffect:
componentDidMount
useEffect
class NoSSR extends React.Component { constructor(...args) { super(...args); this.state = { canRender: false }; } componentDidMount() { this.setState({canRender: true}); } render() { const { children, onSSR = <DefaultOnSSR />} = this.props; const { canRender } = this.state; return canRender ? children : onSSR; } }
Source: https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js
Sample hydration mismatch in Next.js app:
Similar issue: #226
Edit: I'm happy to help to contribute this feature if you want it in react output target
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Prerequisites
Describe the Feature Request
Add option to generated react libraries with disabled SSR in React
Describe the Use Case
Generated components should be able to omit SSR phase of rendering in multiple react ssr frameworks like Next.js, Remix and other
Describe Preferred Solution
Wrap every component in "no SSR" component when flag is enabled
Describe Alternatives
Using https://github.com/kadirahq/react-no-ssr when consuming component or add such wrapper into every project
Related Code
You can easily disable SSR using
componentDidMount
/useEffect
:Source: https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js
Additional Information
Sample hydration mismatch in Next.js app:
Similar issue: #226
Edit: I'm happy to help to contribute this feature if you want it in react output target
The text was updated successfully, but these errors were encountered: