DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Dominik Biedebach
Dominik Biedebach

Posted on

react-devto: React Hooks for Dev.to

Hello dear dev.to community!

A few days ago I pushed my React hooks library for dev.to which can be used to fetch articles and user information.

You can find it over here.

Demo

Installation

npm i @d2k/react-devto --save

Usage:

import {
  useArticles,
  useFollowSuggestions,
  useTags,
  useUser
} from "@d2k/react-devto";

const MyComponent = () => {
  // useArticles(page, tag, username)
  const { articles, loading, error } = useArticles();

  // useFollowSuggestions()
  const { suggestions, loading, error } = useFollowSuggestions();

  // useTags(page)
  const { tags, loading, error } = useTags();

  // useUser(username, id)
  const { user, loading, error } = useUser("bdbch");
};

Top comments (1)

Collapse
 
chromadream profile image
Jonathan Nicholas • Edited on

That's actually a quite interesting use for Hooks. Pretty cool.

I may learn React again, if they look like this.

Why You Need to Study Javascript Fundamentals

The harsh reality for JS Developers: If you don't study the fundamentals, you'll be just another β€œCoder”. Top learnings on how to get to the mid/senior level faster as a JavaScript developer by Dragos Nedelcu.