mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
This introduces `ReactLink` which is a super lightweight way to do two-way binding for React. If you want to use a controlled form input today, it's a lot of lines of code: http://jsfiddle.net/T3z3v/ Look how many times `name` is repeated in there. And you have to remember to wire up event handles and pass the right state and right event handler for *each* form field. It's really annoying. With ReactLink, you can "link" a form value to a state field. It's just some simple sugar around the value prop/onChange convention: https://gist.github.com/petehunt/6689857 Ah, much nicer! And requires very little core changes or extra bytes. `ReactLink` just wraps the current value and "request change" handler into a little object and provides some sugar to create some from composite component state.