next-with-apollo | Apollo HOC for Next.js | Frontend Framework library
kandi X-RAY | next-with-apollo Summary
kandi X-RAY | next-with-apollo Summary
Apollo HOC for Next.js
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of next-with-apollo
next-with-apollo Key Features
next-with-apollo Examples and Code Snippets
Community Discussions
Trending Discussions on next-with-apollo
QUESTION
Contrast in "apollo-client in next.js" approaches chosen in next-with-apollo
npm library and the approach shown in next.js docs.
The link of approach chosen by next.js for apollo client: https://github.com/vercel/next.js/blob/canary/examples/with-apollo/lib/apolloClient.js
- no third-party library next-with-apollo is used
- no get-data-from-tree is used
- Moreover i found this approach more meaningful and elegant inner-working of client side redering and SSR of apollo-client in next.js. I strongly like this
Some cons in next-with-apollo
approach
- in next-with-apollo docs, it is stated that in withApollo API, the parameter getDataFromTree of intialState defaults to undefined by implementaion and its stated "It's recommended to never set this prop, otherwise the page will be a lambda without Automatic Static Optimization "
- get-initial-props is used which is not recommended by next.js for optimization reasons general thing. Why to consider third party library if there is non-third party way and suggested officially unless it has drawbacks?
It made me really curious to see many are using next-with-apollo
and rarely seen the usage of the approach shown in next.js docs? I'm curious whether approach in next.js docs has any drawbacks (which i strong think of not having any)?
- does the approach shown in next.js has some drawbacks?
- does next-with-apollo has more efficiencies? if so what r those more efficiencies for which it is wise not to choose next.js doc approach. I wanna be sure that if i'm rejecting next.js doc approach (currently im choosing it) i'm not doing any wrong
So which is better for both client-side data fetching and server-data fetching to support both CSR and SRR?
...ANSWER
Answered 2021-Aug-20 at 17:34I found the answer by posting in next.js community:
Here it goes:
next.js doc's apollo examples avoid using getDataFromTree because it traverses the react tree twice in order to trigger all the queries and collect their result afterwards.
The drawback of using the approach on the next.js doc's apollo examples is since you don't use
getDataFromTree
, you have no way to know which queries your inner components are using. So you need to remember to prefetch everything you need ongetStaticProps
/getServerSideProps
and match the exact same queries/variablesnext.js doc's apollo examples way is recommended instead of
getInitialProps
so I would always use them unless one has some very specific reason not to
QUESTION
I have very short code, where I am trying to use https://github.com/lfades/next-with-apollo , next-with-apolo. But the SSR does not work in my case, and I am still doing client call, maybe someone can guide me.
My with apollo ->
...ANSWER
Answered 2021-Apr-09 at 14:23The request is being called on client side cause you have written const { data } = useQuery(QUERY);
in Profile Component. So when component is rendered on client side then that query is called.
If you want to call that query only on server side i.e ssr then use getServerSideProps
method and in that call the given query and pass the result as props to the Profile Component
Example:
QUESTION
ANSWER
Answered 2021-Jun-01 at 17:53The issue is on line:
QUESTION
I have a Next.js project, where I want to use Google Analytics Ecommerce, but I am getting Missing Ecommerce Data, View is configured for Ecommerce, but no data is flowing.
warning message and I don't how to fix this.
E-commerce is enabled in GA
I used this blog post to add GA into Next.js
./lib/gtag.js
...ANSWER
Answered 2021-May-15 at 16:49I installed Google Analytics Debugger which told me the parameters are not correct. I fixed that in my code by removing braces in function parameters:
QUESTION
I am using Nextjs and Vercel to deploy my website. Cypress was working fine yesterday. But today when Vercel runs the build I get the following error:
I noticed that vercel was installing Cypress version 6.9.0 whereas I had 6.8.0 in my package.json
file.
So I updated to version to 6.9.0 but I still get the same error. Why is this suddenly happening?
My package.json
file
ANSWER
Answered 2021-Apr-06 at 01:58Cypress team published 6.9.0 by mistake, really the version is 7.0.0 and they will remove 6.9.0:
QUESTION
maxbause was kind to create a nice boilerplate project for Next.js that includes GraphQL and styled components in TypeScript.
Nonetheless, when I added ESLint to the project I got several warnings and errors because the cause was basically plain JavaScript.
I fixed most of it but I am stuck with two warnings in the _document.tsx file.
First of all, I am getting the following warning on the any part of Document< any>: "Unexpected any. Specify a different type." If I remove any and use nothing, unknown or never then I get errors with the this.props.styleTags.
The second issue is with the Missing return type on function warning thrown by the missing return type in ctx.renderPage = () =>
right after the try where I don't know what I should add.
I am a bit of a noob in TypeScript so please don't be too harsh on me if there is an obvious solution to this. I search quite a bit but couldn't figure it out.
I know I can ignore or even disable these errors but if I am to disable the errors I would appreciate if you could explain why it makes sense to do so.
I hope this question is useful to everyone interested in using Next.js with TypeScript.
_document.tsx (where the warnings are thrown)
...ANSWER
Answered 2020-Apr-06 at 21:35Hope it's still useful to you.
EDIT: I should note that I am not sure if this is the correct typing. However this does silence the TypeScript linter without giving it an implicit any type.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install next-with-apollo
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page