@mollycule/vigilante
v1.0.2
Published
A React hook to keep a watch on the changing props of a React component/hook.
Downloads
114
Readme
@mollycule/vigilante
A React hook to keep a watch on the changing props or state variables of a React component/hook.
Table of Contents
About The Project
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.
Built With
Getting Started
Prerequisites
Following Peer Dependencies are required for using useVigilante package:
- react: "^16.0.0"
Install
npm install --save @mollycule/vigilante
yarn add @mollycule/vigilante
Usage
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>
)
}
License
MIT © paramsinghvc
Contributing
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
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Param Singh - @paramsinghvc - [email protected]
Project Link: https://github.com/paramsinghvc/vigilante