Need to fetch data for my navbar
Unanswered
Toyger posted this in #help-forum
ToygerOP
I have a navbar on the site layout, inside of that navbar there is a search bar component. The searchbar takes an array as props (quite big too, over 10000 items) so that it can autocomplete as you write on it. My question is, where should I fetch this data? I am current fetching it on my layout (prisma db call), which feels wrong, but I don't know where else to put it since there is no route associated with it, it's going to be used on the whole page.
1 Reply
Asari
I would localize it closer to the components that need it (unless you are actually disseminating that data throughout the layout, which likely doesn't seem appropriate anyways).
I have an Autocomplete component using a third-party API. The only prop I pass through is a setSelected so that its parent component gets all the selected data and you do with it as you please.
I have an Autocomplete component using a third-party API. The only prop I pass through is a setSelected so that its parent component gets all the selected data and you do with it as you please.