P粉6708387352023-09-02 09:52:51
RTK queries do not require useEffect
to run the query on the mount.
RTK queries automatically handle query execution and caching. By simply calling the generated endpoint function, you will be able to send requests and receive responses.
Based on the above code you can optimize your code like this.
const Component = ({ id }) => { const { data } = usePostCheckApplicationMutation({ application_id: id }); console.log(data); return <div>Component content</div>; };