React JS Prompt Component

Prompt Component in react works once , after clicking Ok , it fails to load next time

You need to give more information for people to be able to help you.

Providing an example and describing your expected result vs the actual result is a great way to start

@React_JS_Ninja ,

Kindly be more specific about the scenario you are facing problem with. Hope this link helps you get an idea.

 const [isEntering, setIsEntering] = useState(false)
  const focusedHandler=()=>{
    setIsEntering(true)
}
<Prompt
                when={isEntering}
                message={(location)=>"Changes you made may not be saved,Sure you want to leave?"}
                />
it works for the first when i click ok from next  time  i'm not getting the alert

btw how to clear the history of react router , if you have any idea on that , kindly ping me

I have used it but the thing it works only once

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.