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

Client Side Components #487

Closed
redxtech opened this issue Aug 18, 2020 · 2 comments
Closed

Client Side Components #487

redxtech opened this issue Aug 18, 2020 · 2 comments

Comments

@redxtech
Copy link

Feature Request

Describe the solution you'd like
A way to exclude components/elements from being prerendered. Either a wrapper component to wrap around components that we only want rendered on client side or an attribute/directive that tells react-snap to ignore all the component/element's children.
The attribute might be the best way to keep this framework agnostic though.

Describe alternatives you've considered
I've tried using vue-client-only but it appears as though the components are still rendered by react-snap.

Teachability, Documentation, Adoption, Migration Strategy
Surround the component you want to be client-only with the wrapper component OR add the snap-client-only (for example) diractive/attribute to the component you want to be client-only.

@stereobooster
Copy link
Owner

const Snap = ({ children }) => {
  const isReactSnap = navigator.userAgent === 'ReactSnap';
  return isReactSnap ? null : children
}

@redxtech
Copy link
Author

Perfect, thanks.

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