@frontendchamp/react-utils
v1.0.4
Published
A utility library for React, including useful components and hooks to simplify common tasks.
Downloads
1
Maintainers
Readme
react-utils
A utility library for React, including useful components and hooks to simplify common tasks.
Features
usePageTitle
Hook: Manage the document title with ease.
Installation
You can install it via npm:
npm install @frontendchamp/react-utils
Usage
usePageTitle
Hook
This hook provides functions to get and set the document title.
import React, { useEffect } from 'react';
import { usePageTitle } from 'react-utils';
const App = () => {
const { getTitle, setTitle } = usePageTitle();
useEffect(() => {
console.log('Current title:', getTitle());
// Example of setting the title
setTitle('Welcome to My App');
// Verify title was set
console.log('Updated title:', getTitle());
}, [getTitle, setTitle]);
return <div>Check console for title changes</div>;
};
export default App;
Development
To get started with development, follow these steps:
Install Dependencies:
npm install
Start the Development Server:
npm run dev
Build the Package:
npm run build
Lint Your Code:
npm run lint
Preview the Build:
npm run preview
Contributing
If you'd like to contribute to this project, please open an issue or submit a pull request. Make sure to follow the code style and add tests where applicable.