Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16 - re-render - react #177

Open
kenmori opened this issue Oct 6, 2024 · 0 comments
Open

16 - re-render - react #177

kenmori opened this issue Oct 6, 2024 · 0 comments

Comments

@kenmori
Copy link

kenmori commented Oct 6, 2024

App.jsx

import { useState } from "react";

import { Button } from "./components/button";
import { ModalDialog } from "./components/basic-modal-dialog";
import { VerySlowComponent } from "./components/very-slow-component";
import { BunchOfStuff, OtherStuffAlsoComplicated } from "./components/mocks";

export default function App() {
  return (
    <>
      <Modal />
      <VerySlowComponent />
      <BunchOfStuff />
      <OtherStuffAlsoComplicated />
    </>
  );
}

const Modal = () => {
  const [isOpen, setIsOpen] = useState(false);
  return (
    <>
      <Button onClick={() => setIsOpen(true)}>Open dialog</Button>
      {isOpen ? <ModalDialog onClose={() => setIsOpen(false)} /> : null}
    </>
  );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant