Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

knockout-bind-react

2.1.1 • Public • Published

knockout-bind-react

A custom binding for KnockoutJS that renders a given ReactJS component within the specified element.

Installation

npm install knockout-bind-react

Include via your preferred AMD/CommonJS loader, or with a <script> tag.

Usage

The react binding expects one value, an object containing the various options for the component:

  • component: The desired React component
  • props: An object containing the props to be passed into the the React component
<div data-bind="react: reactOptions"><div>
var viewModel = {
    self.reactOptions = {
        component: ReactButton,
            props: {
                color: 'red',
                type: 'primary'
            }
    };
};

See index.html, or this example page, for more detailed and dynamic usage.

Install

npm i knockout-bind-react

DownloadsWeekly Downloads

2

Version

2.1.1

License

MIT

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • avatar