- Javascript map function
- State, Hooks
- What is Super() in React js?
- What is the Difference Between the build version & the dev version of the React js?
- How to Host React app on Heroku?
- What is Axios?
- Store UserID, token, username in LocalStorage.
2) What is a State in React js?
- A state is a JavaScript object that stores a component’s dynamic data and it enables a component to keep track of changes between renders.
- Because the state is dynamic, it is reserved only for interactivity so you don’t use it for static React projects.
- The state is managed within the component (similar to variables declared within a function)
- The state is an instance of React Component Class can be defined as an object of a set of observable properties that control the behavior of the component
The
state
object is where you store property values that belong to the component.When the
state
object changes, the component re-renders.- Refer to the state object anywhere in the component by using the this.state.propertyname syntax:
- States can only be used in Class Components.
- A state is an observable object that is to be used to hold data that may change over time and to control the behavior after each change.
What is a hook in React js?
Examples are
Hooks are a special function that allows you to connect with react features.
Hooks don’t work inside classes. But you can use them instead of writing class.
React provides a few built-in Hooks like useState, useEffect.
We can also create our own hook to reuse stateful behavior between different components.
Hooks let you use state & other react features without writing a class.
useState is a hook that lets you add `React state` to the function component. previously you can only use state with class components.
What is useState Hook?
- useState hook is used to declare the state variables into the functionals component.
useState
is a new way to use the exact same capabilities in a `function` thatthis.state
provides in a `class`.
Difference between build version & Production version of Reactjs
- By default, React includes many helpful warnings. These warnings are very useful in development. However, they make React larger and slower so you should make sure to use the production version when you deploy the app
0 comments:
Post a Comment