In React, it’s possible that the page is re-rendering or updating too quickly after the click event, causing the console message to disappear before you can see it
You can try adding a delay before the page re-renders or updates
You can modify your code to wait for a few seconds before updating the state or re-rendering the component:
const handleClick = () => {
console.log('Message');
setTimeout(() => {
// Your code that updates the state or re-renders the component goes here
}, 3000); // wait for 3 seconds before updating the state or re-rendering the component
};
return (
<button onClick={handleClick}>Click me</button>
);
This will give you some time to see the message in the console before the state is updated
Alternatively, you could try using a different browser to see if the issue is specific to Chrome.