0.1.1 • Published 4 years ago

@kyounghwan/custom-hook v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@kyounghwan/custom-hook

custom hook

Install

npm install @kyounghwan/custom-hook
yarn add @kyounghwan/custom-hook

Usage

useInput

import React from "react";
import { useInput } from "@kyounghwan/custom-hook";

export default function App() {
  const [data, setData] = useInput({
    title: "",
    content: ""
  });
  return (
    <>
      <span>{data.title}</span>
      <input name="title" value={data.title} onChange={setData} />
      <span>{data.content}</span>
      <input name="content" value={data.content} onChange={setData} />
    </>
  );
}

useTitle

import React from "react";
import { useTitle } from "@kyounghwan/custom-hook";

export default function App() {
  const updateTitle = useTitle("Loading ...");
  setTimeout(() => updateTitle("login"), 5000);

  return <>...</>;
}

useAxios

import React from "react";
import { useAxios } from "@kyounghwan/custom-hook";

export default function App() {
  const { loading, data, err, refatch } = useAxios({ url: "https:~~~" });

  return <button onClick={refatch}>refatch</button>;
}

License

MIT © kyounghwan

0.1.1

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago