Skip to content

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

License

Notifications You must be signed in to change notification settings

calvinwoo/knockout-bind-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published