Time Need: 30 min
Time Need: 25 min
Time Need: 60 min
Time Need: 200 min
Time Need: 20 min
Time Need: 70 min
58kg
Weight
5.5
Height
22yrs
Age
Add a break
10m
25m
32m
58m
Activity Time:
0 min
Break Time:
min
The work process of react is given below:
ReactJS divides the UI into isolated reusable pieces of code known as components. React components work similarly to JavaScript functions as they accept arbitrary inputs called properties or props. It's possible to have as many components as necessary without cluttering your code. A state is a JavaScript object that represents a part of a component. It changes whenever a user interacts with the application, rendering a new UI to reflect the modifications. State management refers to the practice of managing React application states. It includes storing data in third-party state management libraries and triggering the re-rendering process each time data is changed.
Differences between props and state are given below:
props | state | |
---|---|---|
1 | The Data is passed from one component to another. | The Data is passed within the component only. |
2 | It is Immutable (cannot be modified). | It is Mutable ( can be modified). |
3 | Props can be used with state and functional components. | State can be used only with the state components/class component (Before 16.0). |
4 | Props are read-only.. | State is both read and write. |
The usage of useEffect Hook is given below:
Some examples of side effects are: fetching data, directly updating the DOM, and timers.
useEffect(callback, dependencies) is the hook that manages the side-effects in functional components. callback argument is a function to put the side-effect logic. dependencies is a list of dependencies of your side-effect: being props or state values.