I have this handler submitting a fetcher
const fetcher = useFetcher();
const handlerLogin = () => {
fetcher.submit({ value: 'social', value1:'second', value3:'third' }, { method: 'POST' });
};
It is accessing the action method properly (router 6). I could access all the values in the first array (parameter) as:
export async function action({request, params}){
const formData=Object.fromEntries(await request.formData())
console.log(formData.value1) ---> prints: second
How could I access the value(s) passed in the second array, i.e. { method: 'POST' }?
>Solution :
You can access the value of the method property by using dot notation or bracket notation, like this:
console.log(request.method); // print "POST"