Have a default set of data when loading page, before search has been used.
Answered
Golden paper wasp posted this in #help-forum
Golden paper waspOP
Hi,
I have the searching of the database (supabase) all set up. When a user uses the search bar the results are being fetched and shown on the website. However, I would like to have an default set of data on the page when loading it in (can be random data) Before the user uses the search function.
Question here is, does supabase let me load in a default set of data on page load? Or do I need to have some other magic going on?
I have the searching of the database (supabase) all set up. When a user uses the search bar the results are being fetched and shown on the website. However, I would like to have an default set of data on the page when loading it in (can be random data) Before the user uses the search function.
Question here is, does supabase let me load in a default set of data on page load? Or do I need to have some other magic going on?
2 Replies
Golden paper waspOP
I now have the following but this doesn't work as DefaulSearchresult is not called on page load.
{ searchResults ? <ValidSearchResult /> : <DefaultSearchResult /> }Golden paper waspOP
I fixed it by using useEffect()
Answer