Skip to content
Discussion options

You must be logged in to vote

Yeah... but it depends... consider this example:

import useSWR from "swr";

const useData = () => {
  return useSWR<string>("data", () => {
    return new Promise((resolve) => setTimeout(resolve, 1000, "data"));
  });
};

const Parent: React.FC = ({ children }) => {
  const { data } = useData();
  console.count("Parent");

  return (
    <section>
      <h1>Parent {data}</h1>

      {children}

      <Child label="inner" />
    </section>
  );
};

const Child = ({ label }: { label: string }) => {
  const { data } = useData();
  console.count(`Child: ${label}`);

  return <p>{data}</p>;
};

const Home: NextPage = () => {
  return (
    <div>
      <Parent>
        <Child label="1" />
        

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@icyJoseph
Comment options

@pke
Comment options

@icyJoseph
Comment options

@pke
Comment options

@icyJoseph
Comment options

Answer selected by stefan-spittank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants