-
Notifications
You must be signed in to change notification settings - Fork 278
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
Use clientOnly
without isolating component in its own file
#840
Comments
clientOnly
without isolating component in its own file
I'll check if this can be accomplished this way and I'll check with the team if there's any repercussions I'm not able to predict right now. As for the helper, this is probably a feature request to made on SolidStart. In this repository we just document the existing APIs and offer guides on how to use them. |
I have a working wrapper which looks something like this: import { clientOnly } from '@solidjs/start'
import { Component } from 'solid-js'
// Client side render wrapper
type ResolveClientComponent<T> = (value: {
default: Component<T>
}) => void
export const useClient = <T,>(App: Component<T>) => {
return clientOnly(() => {
return new Promise((resolve: ResolveClientComponent<T>) => {
resolve({ default: App })
})
})
} |
I think we probably need to figure out a code solution to this before being able to document it. I think using this would be recommended https://github.com/lxsmnsyc/solid-use/blob/main/docs/client-only.md |
What is this request related to?
Request
📋 Suggested
https://docs.solidjs.com/solid-start/reference/client/client-only
📋 General description or bullet points
Provide a way of using
clientOnly
without creating a separate file.Code wise, this could be more ergonomic.
Could also create a helper function to directly translate component function to client only component.
🖥️ Reproduction of code samples in StackBlitz
StackBlitz doesn't support solid-start
The text was updated successfully, but these errors were encountered: