how can i change the state value using a prompt in react js?

set the prompt value to a variable

const promptValue = prompt(('enter my name')

and than Use it in the sethayko(promptValue) hook onClick like

<button onClick={() => sethayko(promptValue)}> Change me </button>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top