Noob question: NextJS DI to avoid prop drilling?
I'm working on a project were we have a lot of props being drilled
>A
>B
>C
>D
.....
I
We use a lot of data or traffic getting a new page because we call the same api or get the same data to build or pages. We use 6 Contexts with their own data being fetched and handled down to the pages, components etc.
Is there a better way to do this? what am I missing?
Angular have these services etc. u just inject into ur component like this xx[service, service2]
5 Replies
next does not avoid that
if the context is more async, you can check react query
if is more sync, check jotai or zustand
Thanks, I'll looking into it. I Was afraid of that 🙂
next is more for routing, and data handling
not too much into react internals
Just to be clear, is there anyway in react/next to avoid prop drilling or dependencies?
next, no
remix kinda does