Alleged Professionals get stuck on stupid things too!

Alleged Professionals get stuck on stupid things too!
0
#1

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
#2

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:

https://codepen.io/jenovs/pen/gJbdwP?editors=0010

2 Likes