@frontendchamp/react-utils
v1.0.4
Published
A utility library for React, including useful components and hooks to simplify common tasks.
Maintainers
Readme
react-utils
A utility library for React, including useful components and hooks to simplify common tasks.
Features
usePageTitleHook: Manage the document title with ease.
Installation
You can install it via npm:
npm install @frontendchamp/react-utilsUsage
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 installStart the Development Server:
npm run devBuild the Package:
npm run buildLint Your Code:
npm run lintPreview 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.
