reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
10.86k stars 7.45k forks source link

[Suggestion]: Add `isPending` example to `useActionState` docs #6987

Open JakeSaterlay opened 1 week ago

JakeSaterlay commented 1 week ago

Summary

A section to describe the isPending value you can extract from useActionState

Page

https://react.dev/reference/react/useActionState

Details

You can do const [state, action, isPending] = useActionState(myAction, null); to extract the pending state from useActionState however I can't see an example of this anywhere in the documentation, adding this as an example would be quite useful

JakeSaterlay commented 1 week ago

Opened https://github.com/reactjs/react.dev/pull/6989 to work on this