reactjs / react.dev

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

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

Closed JakeSaterlay closed 1 month ago

JakeSaterlay commented 4 months 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 4 months ago

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