@jsjoeio/react-use-sw-quote
v1.0.0
Published
a custom React Hook for getting a random Star Wars Quote
Downloads
1
Readme
@jsjoeio/react-use-sw-quote
a custom React Hook for getting a random Star Wars Quote
Install
npm install --save @jsjoeio/react-use-sw-quote
Usage
import React from 'react'
import { useStarWarsQuote } from '@jsjoeio/react-use-sw-quote'
const App = () => {
const { quote, loading } = useStarWarsQuote('')
// Quote returns a random quote as a string
// loading returns a boolean
if (loading) {
return <div>Loading...</div>
}
if (quote) {
return <div>
{quote}
</div>
}
return null
}
export default App
License
MIT © jsjoeio
This hook is created using create-react-hook.