Skip to content

jsjoeio/use-star-wars-quote

Repository files navigation

@jsjoeio/use-star-wars-quote

a custom React hook that provides a random Star Wars quote

NPM JavaScript Style Guide

Install

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

Usage

import React from 'react'
import { useStarWarsQuote } from '@jsjoeio/use-star-wars-quote'
 
const App = () => {
  const { quote, loading } = useStarWarsQuote()
 
  if (loading) return <p>Loading...</p>
 
  if (quote) {
    return (
      <div>
        {quote}
      </div>
    )
  }
 
  return null
}
export default App

License

MIT © jsjoeio


This hook is created using create-react-hook.