1.0.1 • Published 5 years ago

hooks-library v1.0.1

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

hooks-library

React Hooks Library

NPM

Install

npm install --save hooks-library

Available hooks

useAxiosGet
useBreakpoint
useFormInput

useAxiosGet

import React, { Component } from 'react';
import { useAxiosGet } from 'hooks-library';

const Example = () => {
  const [{ data, isLoading, isError }] = useAxiosGet('url');

  return (
    <div>
      {isError && <div>Something went wrong...</div>}
      {isLoading ? <div>Loading...</div> : <div>{data}</div>}
    </div>
  );
};

useBreakpoint

import React, { Component } from 'react';
import { useBreakpoint } from 'hooks-library';

const Example = () => {
  const brkPnt = useBreakpoint();

  return <div>{brkPnt}</div>;
};

useFormInput

import React, { Component } from 'react';
import { useFormInput } from 'hooks-library';

const Example = () => {
  const value = useFormInput();

  return (
    <div>
      <input {...value} />
    </div>
  );
};

License

MIT © jdelucaa