I have an page and navigate to that with some search parameters. now I wanna go to the previous URL and clear search params. I Handle actions by useSearchParams (React-router-dome v6)
in useEffect return callback function I setSerachParams with an empty object. its works and clear the params but nvaigate(-1) doesn't work and It does not return to the previous page
It sounds like you're trying to clear the search parameters and navigate back to the previous page using React Router v6. When you use navigate(-1), it's supposed to go back to the previous page in the history stack.
If clearing the search parameters in the useEffect callback is not working as expected, you might want to check a couple of things:
Make sure you are using useEffect correctly. It should look something like this:
Ensure that the component containing this logic is actually mounted when useEffect runs. If it's unmounted, the cleanup function might interfere with navigation.
Double-check if there are any other hooks or components interfering with the navigation.