Skip to content
Discussion options

You must be logged in to vote

The reason your entire application is showing loading, and not just the data you're fetching, is because of this line.

if (!data) return <h1>Loading...</h1>;

If you'd like to only render the list of beers client side, you should only apply the loading state to that piece of the returned JSX.

  return (
    <MainLayout>
      <style jsx>
        {`
          li img {
            max-width: 100px;
          }
        `}
      </style>
      {!loading && <List
        grid={{ gutter: 16, column: 4 }}
        dataSource={data.beers}
        renderItem={(beer) => renderCard(beer)}
      />}
    </MainLayout>
  );

If you're using SWR, you can remove getStaticProps since you're doing client-si…

Replies: 1 comment 1 reply

Comment options

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

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