react

"mulling over state management stuff"
Aron 2020-04-29T01:00:49.218100Z

This tearing thing, anyone actually met it in practice? Because I usually just rerender the whole app for any state update, I know it's supposed to be slow or wasteful, but I never had big enough app for this to matter. I mean, unless it's a high fps game, I can't imagine how.

lilactown 2020-04-29T23:48:00.221800Z

I'm not sure how up to date this is, but is answering a lot of ??? I have atm: https://gist.github.com/Jessidhia/49d0915b7e722dc5b49ab9779b5906e8

lilactown 2020-04-29T23:52:18.224800Z

one question I still have is whether priority is conveyed across async frames, e.g.:

function sleep(ms) {
  return new Promise(res => setTimeout(res, ms));
}

function inc(n) {
  return n + 1;
}

function Button() {
  let [count, setCount] = useState(0);
  let onClick = async () => {
    await sleep(1000);
    setCount(inc);
  }
  return <button onClick={onClick}>+</button>
}

Aron 2020-04-30T13:20:21.226Z

I don't think it does and I am not sure I wish it to be. Reason being that if a users starts clicking vehemently repepeatedly and that means launching lots of background requests, I don't want later clicks to be blocked by the responses given to earlier clicks

Aron 2020-04-30T13:20:54.226200Z

and that's true even if it's not user's fault but let's say, network is slow and piles up responses that arrive at the same time