注意!! 2024/06/18現在、まだRC版なので使い方が変わる可能性があることを留意してください。 公式サンプル(JavaScript版) 元記事 // Using <form> Actions and useActionState function ChangeName({ name, setName }) { const [error, submitAction, isPending] = useActionState( async (previousState, formData) => { const error = await updateName(formData.get("name")); if (error) { return error; } redirect("/path"); return null; }, null, ); return ( <form acti
![React19のuseActionsStateをTypeScriptで書く](https://cdn-ak-scissors.b.st-hatena.com/image/square/c0389b86b95d78fde8fe118df84fc60513c9be8d/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--AvakqBdM--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3AReact19%2525E3%252581%2525AEuseActionsState%2525E3%252582%252592TypeScript%2525E3%252581%2525A7%2525E6%25259B%2525B8%2525E3%252581%25258F%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Adaijinload%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUNnOG9jSTVLVGMxQWhOTXo1cnhrSkFmYmdmRmF1SGwxRGFwX0o3NnpXQ1oxMHpTTGc9czk2LWM%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)