useState()
Hook
- How does React differ from vanilla JS/HTML/CSS?
It differs from it’s syntax to how it deals with data and how it renders everything, although underneath it’s just js, html and css.
But it also allows things vanilla code doesn’t, or maybe has a much harder time doing, like easier reusing of components, faster app building, more modularized code and others.
- What is the primary difference between a function component and a class component?
One is a function, and one is a class, meaning the function one is just a simple js function, while the class one needs you to create a class that extends a the React.Component
one, and super(props)
in it’s constructor.
Other than that there’s performance, compatibility, which is easier to read/work with…etc.