What's the way to force an action to be triggered using useSubmit without any checks?
P粉301523298
P粉301523298 2023-08-14 13:21:36
0
1
443

react-router-dom v6

When I submit the operation using the get method

useEffect(() => { if (!standardSelected) return; clearTimeout(sectionListTimeOutId); const clearTimeoutId = setTimeout(() => { console.log('>>> use submit called'); submit({ standard_id: standardSelected }, { method: 'get' }); }, 1000); setSectionListTimeOutId(clearTimeoutId); }, [standardSelected]);

My action function is not triggered because the action will only be triggered by methods other than the "GET" method.

How can I force useSubmit to trigger an action without checking anything.

P粉301523298
P粉301523298

reply all (1)
P粉852114752

If you want to force an action to be triggered, you can use the"post"method instead of"get"

useEffect(() => { if (!standardSelected) return; clearTimeout(sectionListTimeOutId); const clearTimeoutId = setTimeout(() => { console.log('>>> use submit called'); submit({ standard_id: standardSelected }, { method: 'post' }); }, 1000); setSectionListTimeOutId(clearTimeoutId); }, [standardSelected]);
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!