Replies: 2 comments 4 replies
-
Update: looks like the issue I'm running into may have more to do with how |
Beta Was this translation helpful? Give feedback.
2 replies
-
take a look at swr which is the recommended library to use for client side fetching. edit: have you tried: |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To be honest I'm not sure if I'm even asking for the right thing here, but I'm having trouble feeling confident in specifying what logic runs where (with respect to client vs. server-side rendering).
I'm using [email protected], and I have a straight-forward scenario where I simply want to grab a query string variable and then pass it off to an API request, and I only want to do this client-side (the site is to be statically generated and thrown into an S3 bucket).
Here's a simplified example of the page:
As straight forward as this requirement is, I feel a bit lost after browsing the documentation:
getStaticProps
is out, because it's a server-side, build-time operation.getServerSideProps
is out because it's a server-side, per-request operation.getInitialProps
seems out because the documentations recommends using one of the above two options.getInitialProps
, I now qualify for ASO, so myuseEffect
hook again initially executes with build-time value foritemId (
undefined`).getInitialProps
to opt-out of ASO, the page now requires SSR, and can no longer be statically hosted.isMounted
flags, dynamically importing modules with this kind of logic, etc., but... I feel like I have to be missing something fundamental by the time I get here?I guess to turn this into specific questions:
useEffect
hook initially receive the undefineditem
fromuseRouter()
?Beta Was this translation helpful? Give feedback.
All reactions