Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, I honestly wonder if, with a few minor changes to make it more conventional js, you could address a lot of the criticism.

Suppose you replace:

  const [count, setCount] = useState(0);
with

  const [count, setCount] = this.useState("count", 0);
I'm just speculating idly, but if you use `this`, it's clear how the function knows it's component. If you pass an explicit key, I don't think you need the order to matter. And if the order doesn't matter, well, conditional logic ought to work normally, even if it's a bad idea?

I have no idea if there's a compelling reason this wouldn't work, but if it would, it seems like it could take a lot of the magic and nonstandard behavior out of the API.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: