Skip to content

orbitjs/react-orbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-orbit-hooks

React bindings for orbit.js

USAGE

import React, { useEffect } from 'react';
import { useQuery } from 'react-orbit';

export default ArticlesList() {
  const {data: articles = [], query} = useQuery();

  useEffect(() => {
    query(t => t.findRecords('article'));
  }, []);

  return (
    {articles.map((article) => (
      <>
        <h1>{article.attributes.title}</h1>
        <p>{article.attributes.body}</p>
      </>
    ))}
  );
}