Skip to content

farcry-ts/react-farcry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-farcry

React utilities for FarCry.

Experimental!

Usage

import { useMethod, refresh } from "react-farcry";
import { getPost, likePost } from "./rpc-client";

function Post(props: PostProps) {
  const post = useMethod(getPost, { postId: props.id });

  if (post === undefined) {
    return "Loading post...";
  }

  return (
    <div className="Post">
      <PostBody post={post} />
      <LikeButton
        liked={post.liked}
        onLike={async () => {
          await likePost({ postId: props.id });
          refresh(getPost);
        }}
      />
    </div>
  );
}

About

React utilities for FarCry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published