A React hook to keep a watch on the changing props or state variables of a React component/hook.
React hook to keep a watch on the changing props or state variables of a React component/hook.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
.
NPM Link
useVigilante
is a simple plug and play React hook to keep a watch on the changing props or state variables of a React component/hook.
useVigilante('Weather Component', { latLong, weatherData, getWeather })
It gives the console output as below whenever any change in the listed variables happen in the given component or hook.
Following Peer Dependencies are required for using useVigilante package:
- react: "^16.0.0"
npm install --save @mollycule/vigilante
yarn add @mollycule/vigilante
useVigilante(<Component or Hook Name>, { <prop1>, <state1>, <prop2>, ... })
Detailed Usage
import React, { useEffect } from 'react'
import useVigilante from '@mollycule/vigilante'
const WeatherComp = () => {
const latLong = useGeoLocation()
const { getWeather, weatherData } = useWeather()
useVigilante('Weather Component', { latLong, weatherData, getWeather })
useEffect(() => {
getWeather(latLong);
}, [getWeather, latLong])
return (
<Holder>
{...}
</Holder>
)
}
MIT © paramsinghvc
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Param Singh - @paramsinghvc - paramsinghvc@gmail.com
Project Link: https://github.com/paramsinghvc/vigilante