add <Activity> example#154
Conversation
|
|
@lockr7 is attempting to deploy a commit to the Damián Ricobelli's projects Team on Vercel. A member of the Team first needs to authorize it. |
| "hast-util-to-jsx-runtime": "^2.3.6", | ||
| "lucide-react": "^0.544.0", | ||
| "motion": "^12.23.22", | ||
| "next": "16.0.0-beta.0", |
There was a problem hiding this comment.
Please, don't update the next package to the beta version
There was a problem hiding this comment.
I don't believe Next 16 has been released yet and afaik this is the version that React 19.2 is included in which is when Activity is introduced.
Totally fine if you don't merge while it's still in beta but just wanted to get this PR open.
If you're aware of a lower version of Next that includes React 19.2, happy to downgrade.
There was a problem hiding this comment.
The library does not depend on NextJS, so I think you could use the Activity API without any issues because the react version in the repo is the new one. I haven't tested it yet, but I don't think you'll have any problems.
There was a problem hiding this comment.
Hmm yea I see. Well, in that case I wonder if we can just document this use case without a preview and just add a sub section in the hook docs: https://stepperize.vercel.app/docs/react/api-references/hook#rendering-methods
Would be great to have a live preview, but I don’t like the idea of use a very early beta version of NextJS affecting all the docs app. This could generate otros unexpected issues in other libraries related to fumadocs
There was a problem hiding this comment.
Sorry haven't had time to get back to this. Saw the new version of next and fumadocs is stable release. Would you want to hold this PR until that's upgraded?
| </React.Activity> | ||
| </> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
You can achieve this in a simpler way, like
const Wrapper = () => {
const { current } = useStepper();
return (
<>
{steps.map((stepId) => (
<React.Activity
key={stepId}
mode={current.id === stepId ? "visible" : "hidden"}
>
<Content id={current.id} />
</React.Activity>
))}
</>
);
};Getting the steps from the defineStepper instance
There was a problem hiding this comment.
ah ya fair callout, originally it was rendering a different component for each step but simplified it to use the basic component

Description
Update to docs to show an example using React's new component (had to update to Next 16 because that's the version that includes React 19.2 where is added)
Related Issues
Checklist
Please review the following checklist before submitting the pull request:
Screenshots (if appropriate)
Additional Notes