Serialized user is only provided to the page component #449
-
|
Hi there and thanks a lot for everything you've done. If the page component exports I'm wondering if it's intended behavior and if so is there a way to make user available for all components on SSR pages to prevent flash on unauthed content within means on this package? [1] At first it'll contain only parsed version without Here is the example: import { withAuthUser, useAuthUser, withAuthUserSSR } from 'next-firebase-auth'
export const getServerSideProps = withAuthUserSSR()()
export default withAuthUser()(function Parent() {
const user = useAuthUser()
console.log('parent', user)
return <Child />
})
const Child = withAuthUser()(function Child() {
const user = useAuthUser()
console.log('child', user)
return null
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You should only wrap the page in |
Beta Was this translation helpful? Give feedback.

You should only wrap the page in
withAuthUser, not any child components. That'll set context that can be used anywhere in the React tree. Does it work if you remove the child'swithAuthUserwrapper?