import React, { useState } from "react"; import useAfterFirstRender from ".."; import Button from "../../../components/Button/Button"; import { Meta, StoryObj } from "@storybook/react"; import Flex from "../../../components/Flex/Flex"; import Heading from "../../../components/Heading/Heading"; type Story = StoryObj; export default { title: "Hooks/useAfterFirstRender" } satisfies Meta; export const Overview: Story = { render: () => { const isAfterFirstRender = useAfterFirstRender(); const [renderCount, setRenderCount] = useState(0); const handleRerender = () => { setRenderCount(prevCount => prevCount + 1); }; return ( <> {isAfterFirstRender.current ? "It is after the first render!" : "This is the first render!"}

Rerender count: {renderCount}

); }, decorators: [ Story => ( ) ], parameters: { docs: { liveEdit: { scope: { Heading } } } } };