@functionspace/react
v0.0.1
Published
React hooks, Provider, and theme system for the FunctionSpace prediction-market SDK.
Maintainers
Readme
@functionspace/react
React hooks, Provider, and theme system for the FunctionSpace prediction-market SDK.
Install
npm install @functionspace/react @functionspace/coreThis package has @functionspace/core as a dependency and React as
a peer dependency.
Quick start
import { FunctionSpaceProvider, useMarket } from '@functionspace/react';
const config = { baseUrl: 'https://fs-engine-api.onrender.com' };
function App() {
return (
<FunctionSpaceProvider config={config} theme="fs-dark">
<MarketView marketId={1} />
</FunctionSpaceProvider>
);
}
function MarketView({ marketId }: { marketId: number }) {
const { market, loading, error } = useMarket(marketId);
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
return <p>Market: {market?.title}</p>;
}For AI agents and LLMs
This package is part of the FunctionSpace Trading SDK. Full LLM-targeted reference docs:
- Index: https://docs.functionspace.dev/llms.txt
- This package: https://docs.functionspace.dev/react.txt
Docs
https://docs.functionspace.dev
License
MIT
