Update formatting
This commit is contained in:
@ -8,7 +8,7 @@ lastUpdated: 2020-11-03T20:42:15+02:00
|
||||
Renders a carousel component.
|
||||
|
||||
- Use the `useState()` hook to create the `active` state variable and give it a value of `0` (index of the first item).
|
||||
- Use the `useEffect()` hook to update the value of `active` to the index of the next item, using `setTimeout`.
|
||||
- Use the `useEffect()` hook to update the value of `active` to the index of the next item, using `setTimeout()`.
|
||||
- Compute the `className` for each carousel item while mapping over them and applying it accordingly.
|
||||
- Render the carousel items using `React.cloneElement()` and pass down `...rest` along with the computed `className`.
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ firstSeen: 2019-08-21T13:20:57+03:00
|
||||
lastUpdated: 2020-11-16T14:17:53+02:00
|
||||
---
|
||||
|
||||
Implements `setTimeout` in a declarative manner.
|
||||
Implements `setTimeout()` in a declarative manner.
|
||||
|
||||
- Create a custom hook that takes a `callback` and a `delay`.
|
||||
- Use the `useRef()` hook to create a `ref` for the callback function.
|
||||
|
||||
Reference in New Issue
Block a user