Socket
Socket
Sign inDemoInstall

@soubai/use-wikipedia

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @soubai/use-wikipedia

A simple react hook for query wikipedia API


Version published
Weekly downloads
2
Maintainers
1
Install size
5.46 kB
Created
Weekly downloads
 

Readme

Source

🧰 useWikipedia: React Hook for query wikipedia API

All Contributors

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 />;
}
  • OR
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 () => {
  // query take search string and limit result per page (default 10)
  const { data, error } = await query(q, 10);
  setData(data);
  setError(error);
};

Example

for more detail about use see ./example/

Keywords

FAQs

Last updated on 17 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc