UNPKG

@state-less/leap-frontend

Version:

A collection of open source fullstack services powered by React Server

12 lines (11 loc) 872 B
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { useComponent } from '@state-less/react-client'; import { Alert, Button } from '@mui/material'; export const HelloWorldExample1 = () => { const [component, { loading, error }] = useComponent('hello-world-1', {}); return (_jsxs(_Fragment, { children: [error && _jsx(Alert, { severity: "error", children: error.message }), _jsx(Button, { onClick: () => component?.props?.increase(), children: "Increase" })] })); }; export const HelloWorldExample2 = () => { const [component, { loading, error }] = useComponent('hello-world-2', {}); return (_jsxs(_Fragment, { children: [error && _jsx(Alert, { severity: "error", children: error.message }), _jsxs(Button, { onClick: () => component?.props?.increase(), children: ["Count is ", component?.props?.count] })] })); };