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

I went and checked, and it is a bit buried at the bottom of the useState explanation when explaining what an example does:

> Line 9: When the user clicks, we call setCount with a new value. React will then re-render the Example component, passing the new count value to it.

https://reactjs.org/docs/hooks-state.html

I think they assume you'll figure out that it must do so to function at all.




This has been true even in the old class components. A component always updates when props update.


It's about state not props. But yes state is more or less implicit props.


I had a co-worker that assumed it worked template-style, where the value in the JSX would update and what's on the page would re-render, but the component function wouldn't be re-run.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: