1.0.1 • Published 4 years ago

@tianboqiu/use-star-wars-quote v1.0.1

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

@tianboqiu/use-star-wars-quote

a custom react hook that provides a random Star Wars quote

NPM JavaScript Style Guide

Install

npm install --save @tianboqiu/use-star-wars-quote

Usage

import React from 'react'
import { useRandomStarWarsQuote } from '@tianboqiu/use-star-wars-quote'

function App() {
  const { quote, loading, error } = useRandomStarWarsQuote();
  if (loading) {
    return <p>IsLoading</p>
  }

  if (error) {
  return <p>Error! {JSON.stringify(error)}</p>
  }
  return (
    <div>
      {quote}
    </div>
  );
}

export default App

License

MIT © Tianbo-Qiu


This hook is created using create-react-hook.

1.0.1

4 years ago

1.0.0

4 years ago