canducci-use-document-title
v1.0.4
Published
Hook useDocumentTitle to change document.title
Downloads
7
Maintainers
Readme
canducci-use-document-title
Install
npm install --save canducci-use-document-title
Usage
import React from "react";
import { useDocumentTitle } from "canducci-use-document-title";
const App = () => {
const [title, setTitle] = useDocumentTitle();
const setTitleName = () => setTitle("New Nome");
const setDateTime = () => setTitle(new Date().toISOString());
return (
<div>
<div>{title}</div>
<button onClick={setTitleName}>Set Name</button>
<button onClick={setDateTime}>Set DateTime</button>
</div>
);
};
export default App;
License
MIT © fulviocanducci
This hook is created using create-react-hook.