-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example with nextjs doesn't work with React hooks #601
Comments
Did you solve this? |
Unfortunately no, but I didn't needed that much. I use firebase and firestore and I've set it up manually inside the project (https://firebase.google.com/docs/web/setup) |
So you are hosting your web app on static hosting? I just posted a question on stackoverflow referencing this issue and a fork of your reproducible bug repo. |
Yes, I am using zeit hosting (default for nextjs) and I configured firebase
manually. This was the best I could do in a few days and I didn't want to
spend much more on it
…On Sat, 19 Oct 2019, 16:42 Maotora ᕙ(⇀‸↼‶)ᕗ, ***@***.***> wrote:
So you are hosting your web app on static hosting?
My Nextjs + Antd app got really slow as the size grew bigger so I thought
only SSR would lift some rendering load.
I just posted a question on stackoverflow
<https://stackoverflow.com/questions/58464758/firebase-cloud-functions-wont-work-with-react-hooks-on-nextjs-ssr>
referencing this issue and a fork of your reproducible bug repo.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#601?email_source=notifications&email_token=AFNA44RMHW7WFVINL7FQMJ3QPMMEHA5CNFSM4IK34NF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBXR6EY#issuecomment-544153363>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNA44UN4CSZAS447HQI3CLQPMMEHANCNFSM4IK34NFQ>
.
|
The problem superficially stems from two copies of the react source code. I'm not 100% sure how it works so I won't even try to explain the root cause of the problem. To fix the problem, please place the app inside the functions folder and remove package.json. Unfortunately, all the dependencies of app must necessarily be dependencies of functions. Then, change next.config.js to this:
and index.js to this:
|
Hi, I wrote the initial example. This example hasn't been kept up to date as I was maintaining my own example and the example in the nextjs repo. My most up to date example does function with React hooks if you would like to check that out https://github.com/jthegedus/firebase-gcp-examples/tree/master/functions-nextjs |
How to reproduce these conditions
I have set up an example repo where you can check the bug.
Steps to set up and reproduce
git clone https://github.com/Siegrift/nextjs-firebase-example
cd src/app
yarn && yarn dev
http://localhost:3000/about
You will get:
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
Expected behavior
I don't think that this example is valid anymore. I was trying to figure out how to make nextjs work with firebase, but I couldn't figure it out.... Anyway, the expected behaviour is to make it work with nextjs and newest React (e.g. react hooks).
Actual behavior
Error in application and I am unable to configure nextjs with firebase.
The text was updated successfully, but these errors were encountered: