cferdinandi / reef

A lightweight library for creating reactive, state-based components and UI.

Home Page:https://reefjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binding input value changes to data

JoshuaPerk opened this issue · comments

Am I understanding the documentation correctly that this will only bind one-way. Meaning, if the input changes, it will not reflect in the data.someKeyValuePair? Has anyone found a clean way to solve for binding a value back to the data object?

That's correct. Like Vue and React, Reef is about binding UI to data, but not the other way around.

You can create two-way binding by listening for changes to form data (using the Element.addEventListener() method with the change event), and updating your data object to match.

This demo might provide a useful model to follow.