Skip to content

How to correctly set the type of the client? #65

@LXVC

Description

@LXVC
function usePublicClient() {
  const [client, setClient] = useState<Client | null>(null);
  const chain = useChain();

  useEffect(() => {
    setClient(
      createClient({
        chain: chain,
        transport: http(),
      }).extend(publicActionReverseMirage),
    );
  }, [chain]);
}

Code as shown above, How should I correctly set the type of useState to ensure that the returned client has all the methods from publicActionReverseMirage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions