usePrevious
- Description
- Params and Return
- Example
Tracks previous value passed in
Param / Return | Description |
---|---|
param | value: value to track for previous |
How to use the usePrevious component
const prevLoadingRequestRefills = usePrevious<boolean>(loadingRequestRefills)
useEffect(() => {
if (prevLoadingRequestRefills && prevLoadingRequestRefills !== loadingRequestRefills) {
navigation.navigate('RefillRequestSummary')
}
}, [navigation, loadingRequestRefills, prevLoadingRequestRefills])