A custom react hook for getting the best dad jokes!
npm install --save @mtliendo/react-use-dad-joke
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>;
};
MIT © mtliendo
This hook is created using create-react-hook.