-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Description
I'm trying to create a HOC for withCurrentUser like this:
import React, { Component } from 'react';
export default WrappedComponent =>
// eslint-disable-next-line react/prefer-stateless-function
class extends Component {
static getInitialProps({ apollo }) {
console.log('it called me');
console.log(apollo);
return { hello: "world" };
}
render() {
return (
<>
<h1>hello from withCurrentUser</h1>
<WrappedComponent {...this.props} />
</>
);
}
};and then trying to use like this:
import React from 'react';
import withCurrentUser from '../../hocs/withCurrentUser';
const NavBar = ({ hello }) => <h1>NavBar {hello}</h1>;
export default withCurrentUser(NavBar);But it's not calling getInitialProps. What am I doing wrong?
kumarabhirup, IvanRozinko, Aid19801, dinaramaro and knowankitkumarabhirup
Metadata
Metadata
Assignees
Labels
No labels