News for hackers. Stuff that matters.
Re:How to write PureScript react components to replace JavaS... by jrh206 on Thursday June 25, 2020 @05:32AM (#23638658)
Posting code on the internet - dangerous business!

I think the counter updates should use functional updates, since they depend on the current state. My understanding is that this can lead to a potential race condition, although I'm not 100% on the details.

  setCounter(currentCounter => currentCounter + 1)
https://reactjs.org/docs/hooks-reference.html#functional-upd...

Interestingly your code is similar to some the first code in the basic 'into to hooks' section of the docs. Perhaps it's not a huge issue? Maybe somebody else who knows a bit more about React internals can chime in.

Re:How to write PureScript react components to replace JavaS... by chvid on Thursday June 25, 2020 @11:27AM (#23641795)
The code I wrote is perfectly fine. There is no possibility of race conditions in the code I wrote.