I cannot take credit for this, most of the work was done by @admamsoffer and his great example repo that you can find here: https://github.com/zeit/next.js/tree/master/examples/with-apollo
My version adds ApolloLinkState to the mix, and was originally written in typescript. I've done my best to remove the types to make it more approachable.
The major change that I made was passing all the appProps to the app component in the with-apollo hoc, something I'm not actually sure is neccesary, and changing RederComponent to simply Component since RederComponent was undefined.
@richbai90 I am unable to create a mutation with your example!! Can't find how to pass cache in mutation file .