Alleged Professionals get stuck on stupid things too!

Story time!

So I am a Professional Web Developer and I got stuck on a bug yesterday that it took me and another Professional Web Developer (with something like 14 years experience) about 3 hours to diagnose and fix yesterday.

It was stupid simple: setState in React to dismiss a modal. Absolute bread-and-butter stuff.

But we got there - after much head scratching and gnashing of teeth.

You can read my postmortem with a couple of CodePen reproductions of the problem and the fix here, if you are interested: https://jacksonbates.github.io/blog/setState-fail

3 Likes

The solution is to separate the onClick listeners appropriately so you are only clicking one thing at a time.

Or you could use .stopPropagation() in widgetHide so the event doesn’t bubble up :wink:

2 Likes