@mtliendo/react-use-dad-joke
v1.0.2
Published
A custom react hook for getting the best dad jokes!
Downloads
2
Readme
@mtliendo/react-use-dad-jokes
A custom react hook for getting the best dad jokes!
Install
npm install --save @mtliendo/react-use-dad-joke
Usage
import React, { Component } from 'react'
import { useDadJoke } from '@mtliendo/react-use-dad-joke'
const App = () => {
const { isLoading, error, dadJoke } = useDadJoke();
if (isLoading) return "Loading...";
if (error) return "uh oh...something went wrong";
return <main>{dadJoke.joke}</main>;
};
License
MIT © mtliendo
This hook is created using create-react-hook.