🧰 useWikipedia: React Hook for query wikipedia API
A hook to help you to query a wikipedia search API
install
yarn add @soubai/use-wikipedia
Usage
import useWikipedia from "@soubai/use-wikipedia";
function MyComponent() {
const { data, error } = useDocumentTitle("Morocco");
return <div />;
}
import useWikipedia from "@soubai/use-wikipedia";
const [error, setError] = useState(null);
const [data, setData] = useState([]);
const [q, setQ] = useState("");
const { query } = useWikipedia();
const search = async () => {
const { data, error } = await query(q, 10);
setData(data);
setError(error);
};
Example
for more detail about use see ./example/