How to use the mobx-react-lite.useComputed function in mobx-react-lite

To help you get started, we’ve selected a few mobx-react-lite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jeffkhull / typescript-fullstack-monorepo / packages / boilerplate-client / src / components / App.tsx View on Github external
const currentPage: JSX.Element = useComputed(() => {
    switch (store.viewStore.currentPage) {
      case AppPage.Home:
        return 
      case AppPage.ComponentsDemos:
        return 
      case AppPage.ServerApiDemo:
        return 
      case AppPage.HooksDemo:
        return 
      default:
        throw new Error(`Unknown page ${store.viewStore.currentPage}`)
    }
  })

  const menuItems: AppkitMenuItem[] = useComputed(() => {
    return [
      {
        name: 'Home',
        onClick: () => {
          store.viewStore.setPage(AppPage.Home)
        }
      },
      {
        name: 'Components Demo',
        onClick: () => {
          store.viewStore.setPage(AppPage.ComponentsDemos)
        }
      },
      {
        name: 'Server API Demo',
        onClick: () => {
github jeffkhull / typescript-fullstack-monorepo / packages / boilerplate-client / src / components / App.tsx View on Github external
export const App = observer(() => {
  const store = React.useContext(StoreContext)
  const currentPage: JSX.Element = useComputed(() => {
    switch (store.viewStore.currentPage) {
      case AppPage.Home:
        return 
      case AppPage.ComponentsDemos:
        return 
      case AppPage.ServerApiDemo:
        return 
      case AppPage.HooksDemo:
        return 
      default:
        throw new Error(`Unknown page ${store.viewStore.currentPage}`)
    }
  })

  const menuItems: AppkitMenuItem[] = useComputed(() => {
    return [

mobx-react-lite

Lightweight React bindings for MobX based on React 16.8+ and Hooks

MIT
Latest version published 7 months ago

Package Health Score

96 / 100
Full package analysis