mobx-react

  • Version 9.1.1
  • Published
  • 650 kB
  • 1 dependency
  • MIT license

Install

npm i mobx-react
yarn add mobx-react
pnpm add mobx-react

Overview

React bindings for MobX. Create fully reactive components.

Index

Variables

variable PropTypes

const PropTypes: {
observableArray: React.Requireable<any>;
observableArrayOf: any;
observableMap: React.Requireable<any>;
observableObject: React.Requireable<any>;
arrayOrObservableArray: React.Requireable<any>;
arrayOrObservableArrayOf: any;
objectOrObservableObject: React.Requireable<any>;
};

    Functions

    function disposeOnUnmount

    disposeOnUnmount: {
    (target: React.Component<any, any>, propertyKey: PropertyKey): void;
    <TF extends Disposer | Disposer[]>(
    target: React.Component<any, any>,
    fn: TF
    ): TF;
    };
    • Deprecated

      disposeOnUnmount is not compatible with React 18 and higher.

    function inject

    inject: {
    (...stores: string[]): <T extends unknown>(
    target: T
    ) => T & (T extends any ? IWrappedComponent<P> : never);
    <
    S extends IValueMap = {},
    P extends IValueMap = {},
    I extends IValueMap = {},
    C extends IValueMap = {}
    >(
    fn: IStoresToProps<S, P, I, C>
    ): <T extends unknown>(target: T) => T & IWrappedComponent<P>;
    };
    • higher order component that injects stores to a child. takes either a varargs list of strings, which are stores read from the context, or a function that manually maps the available stores from the context to props: storesToProps(mobxStores, props, context) => newProps

    Type Aliases

    type IWrappedComponent

    type IWrappedComponent<P> = {
    wrappedComponent: IReactComponent<P>;
    };

      Package Files (5)

      Dependencies (1)

      Dev Dependencies (3)

      Peer Dependencies (2)

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/mobx-react.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/mobx-react)
      • HTML
        <a href="https://www.jsdocs.io/package/mobx-react"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>