It's almost there, but this library does not support SSR:
Not sure exactly how this can be fixed. Can we compute the output of useREM on SSR?
getComputedStyle(document.documentElement).fontSize can't work on the frontend. One possibility could be to add a default fallback value for SSR, and allow to override that value through context on the server? Like <RNWHProvider value={{documentFontSize: 16}}/>?
Another option would be to provide a default fallback value as 2nd arg, like useREM(1.3, 16);
BTW, is useREM really a hook? it does not use any primitive React hook so it's just a function call (that currently only works in the browser)
it's not a hook, it used to be at one point. We're in talks about different styling systems internally, it'd be nice to not have to use this method at all.
Still trying to build https://github.com/expo/examples/tree/master/with-gatsby in production mode, with real SSR.
It's almost there, but this library does not support SSR:
Not sure exactly how this can be fixed. Can we compute the output of useREM on SSR?
getComputedStyle(document.documentElement).fontSize
can't work on the frontend. One possibility could be to add a default fallback value for SSR, and allow to override that value through context on the server? Like<RNWHProvider value={{documentFontSize: 16}}/>
?Another option would be to provide a default fallback value as 2nd arg, like
useREM(1.3, 16);
BTW, is useREM really a hook? it does not use any primitive React hook so it's just a function call (that currently only works in the browser)