I have been stuck for like 2 hours [Objects are not valid as a React child]
Unanswered
Aleutian Tern posted this in #help-forum
Aleutian TernOP
Admittedly with some phone scrolling in the middle, but yeah.
1️⃣
I'm using algolia with next.js (in the procress of migrating). And I'm these errors that prevent compiling:
I've used <Component> instead of {Component}, which seems to be the usually cause of the error
I think the culprit is probably the map section, or the hits section? I can't find the error though.
(obligatory context, it's kind of a study website)
2️⃣ Other small question, I'm aware that
Thank you for reading!
1️⃣
I'm using algolia with next.js (in the procress of migrating). And I'm these errors that prevent compiling:
✓ Linting and checking validity of types
Creating an optimized production build ...
✓ Compiled successfully in 1000ms
✓ Collecting page data
[Error: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props}). If you meant to render a collection of children, use an array instead.]
Error occurred prerendering page "/problemBank". Read more: https://nextjs.org/docs/messages/prerender-error
[Error: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props}). If you meant to render a collection of children, use an array instead.]
Export encountered an error on /problemBank, exiting the build.
⨯ Next.js build worker exited with code: 1 and signal: null
I've used <Component> instead of {Component}, which seems to be the usually cause of the error
I think the culprit is probably the map section, or the hits section? I can't find the error though.
(obligatory context, it's kind of a study website)
2️⃣ Other small question, I'm aware that
searchAPIkey
is "..." lol, idk if it is generally considered safe to post.Thank you for reading!
8 Replies
Aleutian TernOP
I would start by removing components one by one until I can isolate the issue
I think you should start with your JSON.stringify thingy
Aleutian TernOP
well it works if I remove everything inside of instantsearch, but I still can't figure it out
even if there's one div (with nothing attached) inside of it, it breaks
so then I tried doing just <InstantSearch ... />
still though, if there's anything else at all, it breaks
so then I tried doing just <InstantSearch ... />
still though, if there's anything else at all, it breaks
try using 'react-instantsearch-nextjs'
import { InstantSearchNext } from 'react-instantsearch-nextjs';
this one allows childrens
import { InstantSearchNext } from 'react-instantsearch-nextjs';
this one allows childrens
Aleutian TernOP
uh, that kind of fixed it and I got a brand new error lol :D