Project Structure Advice
Unanswered
Bombay posted this in #help-forum
BombayOP
Hi! I have a quick question on optimizing my project structure. Here is the basic structure of my web game
<Grid (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
/>
<SearchBarModal/>
By default, each gridbox has a link component leading to /?gb={gridboxlocation}
When opening the search bar, I need to know what gridbox they selected. I am using query params as "state" to identify this. The problem is, when a user closes the searchbar by submitting a guess, I need to revalidate the page, and every time they open a new gridbox, its an expensive servless function that gets the data for the whole page again.
I'm considering making the GridBox component client rendered, but, without nesting the same modal in each gridbox, how can I tell the modal which gridbox it is? I'm not very familiar with global state or useContext. Is this neccesary here? Do I need it, or is it ok to just nest the modal in each gridbox (6 total modals would then need to be rendered)
<Grid (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
<GridBox/> (use server)
/>
<SearchBarModal/>
By default, each gridbox has a link component leading to /?gb={gridboxlocation}
When opening the search bar, I need to know what gridbox they selected. I am using query params as "state" to identify this. The problem is, when a user closes the searchbar by submitting a guess, I need to revalidate the page, and every time they open a new gridbox, its an expensive servless function that gets the data for the whole page again.
I'm considering making the GridBox component client rendered, but, without nesting the same modal in each gridbox, how can I tell the modal which gridbox it is? I'm not very familiar with global state or useContext. Is this neccesary here? Do I need it, or is it ok to just nest the modal in each gridbox (6 total modals would then need to be rendered)