DEV Community

Discussion on: React Beginner Question Thread ⚛

 
dan_abramov profile image
Dan Abramov

Yep, that’s about it.

The interesting difference from “normal functions” is that the “React functions” (we call them “components”) can be stateful. For example a Checkbox component doesn’t just “return” something unlike a normal function, but can be toggled on and off. We call this “state”.

Thread Thread
 
kremuwa profile image
Michał

The state in "React functions" (components) resembles C++'s local variables, defined inside functions using the static keyword. Such variables keep their value between function calls. If something similar existed in JS, you would be closer to being able to use functions to implement components exclusively, and avoid downsides of using classes that give you a hard time working on async rendering and compilation.