Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSSR: this.context is undefined #218
Comments
This comment has been minimized.
This comment has been minimized.
Here's a documentation about context: https://facebook.github.io/react/docs/context.html |
added a commit
to Vanuan/react-apollo
that referenced
this issue
Sep 19, 2016
jbaxleyiii
closed this
in
#219
Sep 19, 2016
pushed a commit
that referenced
this issue
Sep 19, 2016
tmeasday
referenced this issue
Oct 17, 2016
Closed
Remove assignment of props and context to component in ssr #259
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Vanuan commentedSep 19, 2016
•
edited
Suppose you have the following react component,
and you want to render it using
getDataFromTree
.Cannot read property 'something' of undefined
error occurs.It appears that this code:
https://github.com/apollostack/react-apollo/blob/4271f68d604e7a6f9c23c7a123a0b15573cafd0e/src/server.ts#L48
Doesn't set context if it isn't used in constructor (for some reason it does in the browser).
I didn't check React's source code, but it looks like it sets context even if it isn't used in constructor.
Here's a suggested fix: