ManuelDeLeon / viewmodel-react

Create your React components with view models.
MIT License
24 stars 3 forks source link

Adding ViewModel bindings to existing React Components. #24

Closed martineboh closed 7 years ago

martineboh commented 7 years ago

I am trying to use ViewModel-React with existing React Components from Antd, but it doesn't seems to work. I think ViewModel bindings only work with pure HTML elements, and not ready-made react components like those found in Antd or PUI. Is there any way to support bindings for React Components...like the Input and Button components of Antd, like this:

import { Input } from 'antd';
<Input placeholder="Antd + ViewModel-React" b="value: inputState"/ >
ManuelDeLeon commented 7 years ago

You have to use 3rd party components the way they were designed to be used, not with VM bindings. The only bindings that will work are if, repeat, and ref. So if Input requires you to pass in a callback for the change event, then that's what you need to do.