❌ Conditional rendering loses form state in React.
@_georgemoller118K followers
74,295 views
47 Comments
Comments from the original post on X (Twitter)

@graasdev
Ah thats nice. No longer need to wrap values in context or in parent
6 likes

@_georgemoller
@indiegraas Exactly! :100
1 like

@graasdev
Naming this activity makes absolutely no sense does it 😆
1 like

@zeeshanzubair_
Exactly, losing form state with conditional rendering is such a pain. Activity API feels like a game-changer for building multi-step forms cleanly.
4 likes

@_georgemoller
Agree! so much easier and cleaner approach.
1 like

@itzadetunji1
This is really good and onboarding on apps would be much simpler now with this structure
3 likes

@roxanamuntian
Looks like a powerful feature in React 19. On my current project I use RHF, but no multi-step forms yet. Guess I’ll see how I handle those (no React19 on the project) 😢
2 likes

@_georgemoller
actually RHF doesn't use refs instead of state? this shouldn't be a problem then
2 likes

@roxanamuntian
RHF uses uncontrolled components under the hood and tracks values via refs. Was curious how to handle the multistep forms. Turns out it’s pretty straightforward - one useForm instance at the top level(keeps data even when steps unmount) - FormProvider to share the form instance using React Context - useFormContext in each form step to read the form instance
7 likes

@_georgemoller
Oh cool! Pretty straight forward then.
1 like

@austinkdev
Love the video
1 like

@_georgemoller
Thanks Austin!
1 like

@LouGreenwood
Ever heard of this thing called #EmberJS?
1 like

@_georgemoller
damn I used to work with Ember JS back in the day!
1 like

@LouGreenwood
Come back!
1 like

@smallchano
nice alternative to using context but not super valuable for more complex forms where you are going to need context anyway imo
1 like

@Olwiba
This is epic, what software do you use to make these videos?
1 like

@_georgemoller
hey! I use remotion for these
2 likes

@Florin67086276
Another approch is to use switch case
1 like

@Niyxuis
the number of times i've jury-rigged useRef to hold form state between steps just to avoid this exact problem. Activity API feels like an apology letter from the React team
1 like















