1.0.1 • Published 2 years ago

@c-hooks/use-title v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@c-hooks/use-title

React Hook to change your document's title.

Installation

yarn

yarn add @c-hooks/use-title

npm

npm i @c-hooks/use-title

Usage

import React from "react";
import useTitle from "@c-hooks/use-title";

export default function App() {
  const titleUpdater = useTitle("Loading...");
  setTimeout(() => titleUpdater("Home"), 1000); //1초마다 title text 변경
  return (
    <div className="App">
      <input
        onChange={(e) => {
          titleUpdater(e.target.value); //변경(입력)될때마다 title text 변경
        }}
      />
    </div>
  );
}

Arguments

ArgumentTypeDescriptionRequired
initialTitleanyThe initial Title changes to title element innerTextyes

Returns

ReturnTypeDescriptionDefault value
setTitlefunctionThe setTitle function to be changeed states of title element innerTextnull
1.0.1

2 years ago

1.0.0

2 years ago