Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • your code seems to be ok , I tried that in and it shows 'First' Commented Nov 13, 2022 at 6:43
  • @AliSattarzadeh for me, it shows "First" briefly and then it gets replaced with "Executed". I created this Codesandbox to demonstrate the issue I'm having Commented Nov 13, 2022 at 7:06
  • It is probably because you are in react strict mode and running react 18. Try removing <React.StrictMode> from your app file and it should work Commented Nov 13, 2022 at 7:09