Dynamic app layout with wrapped component in HOC #11337
-
Hi all, I'm trying to get dynamic app layout example working with my page wrapped in HOC. My page export is like this - In this case, I'm getting WrappedComponent instead of Profile which makes sense but how can I access the Layout property from the Profile component in _app.js? I'm looking for a generic solution which can work with any number of HOCs Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @timneutkens I'll really appreciate it if you can provide some guidance, I'm kinda stuck at this point. Thanks |
Beta Was this translation helpful? Give feedback.
-
It's the responsibility of HOCs to hoist statics of the wrapped component. If they do not, they are not proper HOCs and this is not expected to work. See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over |
Beta Was this translation helpful? Give feedback.
It's the responsibility of HOCs to hoist statics of the wrapped component. If they do not, they are not proper HOCs and this is not expected to work.
See: https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over