We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://reactrouter.com/en/main/components/form#mutation-submissions
<Route path="/projects/:id" element={<Project />} loader={async ({ params }) => { return fakeLoadProject(params.id); }} action={async ({ request, params }) => { switch (request.method) { case "put": { let formData = await request.formData(); let name = formData.get("projectName"); return fakeUpdateProject(name); } case "delete": { return fakeDeleteProject(params.id); } default: { throw new Response("", { status: 405 }); } } }} />;
request.method value is lower case. ex) get, post, delete ...
but
real is upper case ex) GET, POST, DELETE ...
my react-router-dom version is "react-router-dom": "^6.4.1",
export const adminDetailAction = async ({ request, params }) => { console.log('-> request', request); console.log('-> request.method', request.method); console.log('-> request.formData', await Utils.convertFormDataToObject(request)); console.log('-> params', params); if ((request.method as FormMethod) === 'patch') { console.log('patch'); } };
const onDeleteAdminHandler = useCallback(() => { submit(null, { action: `/management/admin/${params.adminId}`, method: 'delete' }); }, [params.adminId, submit]); const onPatchAdminHandler = useCallback(() => { submit(null, { action: `/management/admin/${params.adminId}`, method: 'patch' }); }, [params.adminId, submit]);
<Form> <RowTable rows={tableRows} data={tableData} /> <Stack direction={'row'} spacing={2} sx={{ width: '100%', justifyContent: 'center', marginTop: '20px', }} > <Button variant={'contained'} onClick={onDeleteAdminHandler} color={'grey1'}> 삭제 </Button> <Button variant={'contained'} onClick={onPatchAdminHandler} color={'green'}> 수정 </Button> </Stack> </Form>
I am not good at English, so please understand. thank you
The text was updated successfully, but these errors were encountered:
node v16.17.0
Is the capital letter correct? Is it lowercase?
Sorry, something went wrong.
Thanks for the bug report.
<form method="">
<Form method="">
Request.method
docs(components/form): Fix method case in action
bf2f0bf
Closes remix-run#9891
docs(components/form): Fix method case in action (#9893)
bbaca1a
Closes #9891
Successfully merging a pull request may close this issue.
Describe what's incorrect/missing in the documentation
https://reactrouter.com/en/main/components/form#mutation-submissions
request.method value is lower case. ex) get, post, delete ...
but
real is upper case ex) GET, POST, DELETE ...
my react-router-dom version is "react-router-dom": "^6.4.1",
I am not good at English, so please understand.
thank you
The text was updated successfully, but these errors were encountered: