RE

Resq

resq

React Element Selector Query (resq) - Query React components and children by selector (component name)

Data Fetching
react
selector
resq
rescue
queryselector
query
Data Fetching
javascript
npm
frontend
Stars
428
Weekly
1.8M
Open issues
5
Bundle
~25 kB

Installation

npm install resq

Code example

import { useResq } from "resq";

export function Example() {
  const { data, isLoading, error } = useResq({
    queryKey: ["example"],
    queryFn: () => fetch("/api/example").then((r) => r.json()),
  });

  if (isLoading) return <p>Loading…</p>;
  if (error) return <p>Could not load data.</p>;
  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}

Pros & cons

Pros

  • Actively maintained by Baruch Velez
  • 1.8M weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 5 open issues on GitHub

FAQs

Alternatives & similar libraries