Hacker News new | past | comments | ask | show | jobs | submit login

I dont get hooks. How is this simpler than something like this?


Just because the example people use (incrementing a counter) is simple and can be solved very simply, it doesn't mean that these simple solutions will work well for more complex issues. Of course most people are not building apps that just increment a counter. Hooks are for much more than that.

I don't buy the way things are done in this library (constate). I wouldn't import a library just for doing this. It is not very hard to achieve the same with plain `useContext` and `useState` directly.

That being said, I don't agree that hooks are futile, because, using hooks, your state logic can be reused. For example, if your app uses 10 independent counters (with different render logic and different styling), hooks are definitely useful to reuse the state logic.

That only uses local state. With constate you can access the state from anywhere without prop drilling.

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