0.1.1 • Published 6 years ago

@kyounghwan/custom-hook v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 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

6 years ago

0.0.11

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago