ServerOnly #206
Closed
kentcdodds
started this conversation in
Ideas
ServerOnly
#206
Replies: 1 comment 3 replies
-
Let me see if I understood, you want something like this: <ServerOnly>
<input type="hidden" name="noJS" value="true" />
</ServerOnly> And that should be added to the HTML on SSR but removed after that? I usually do this https://sergiodxa.com/articles/progressively-enhance-the-usefetcher-hook-in-remix <input type="hidden" name="no-js" value={String(!isHydrated)} /> I could give you the ServerOnly component tho. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Basically the opposite of ClientOnly.
This is useful for hidden inputs that help you know whether the form was submitted via fetch or not (which helps you determine whether you should use
redirect
orjson
).Alternatively, I could just use the
fallback
prop of theClientOnly
, but the children prop is required there and I don't want anything rendered post-hydration.Until this is added, I'll just use
useHydrated
.Beta Was this translation helpful? Give feedback.
All reactions