DEV Community

bdbch
bdbch

Posted on

4 4

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
Enter fullscreen mode Exit fullscreen mode

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");
};
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
chromadream profile image
Jonathan Nicholas • Edited

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

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

Collapse
 
scriptkavi profile image
ScriptKavi

You can also use scriptkavi/hooks

It is easy to use and pattern is similar to shadcn/ui.

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay