Skip to content

Sqlite Database Added to blitz build #1575

Answered by hariria
hariria asked this question in Ideas
Discussion options

You must be logged in to vote

@flybayer i tried using useQuery in getStaticProps but since thats a function and not a component, React complains about using hooks in a function and not a component. My code is below:

// This function gets called during pre-rendering
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export async function getStaticProps() {
  const category = useQuery(getCategoryPage, { where: { categoryCode: 'hello_world' } });
  return {
    props: {
      category,
    },
  };
}

Home.getLayout = (page) => (
  <Suspense fallback={<FallbackUI />}>
    <Layout title="Home">{page}</Layout>
  </Suspense>
);

export default Home;

The query works fine when I put it in my compone…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@hariria
Comment options

@flybayer
Comment options

@flybayer
Comment options

Comment options

You must be logged in to vote
1 reply
@hariria
Comment options

Answer selected by hariria
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants