Isomorphic code in loader functions w/ SSR
What is the recommended way to write isomorphic code (code for both client/server, SSR-only, etc) for loaders? i.e. if I want to read the users cookies in the loader function, or headers used for a SSR request etc?
For cookies right now I'm doing the following - would like to know how code like this is intended to be done π .
3 Replies
metropolitan-bronzeβ’16mo ago
It would be better to use a serverFn here that has a consistent access pattern.
Buuuuut, your approach isnβt bad necessarily b
adverse-sapphireβ’7mo ago
@lithdew did you find better way to implement this?
ratty-blushβ’7mo ago
we have createIsomorphicFn now