I'm writing a wrapper for React Toolbox for ClojureScript/Reagent called Reagent Toolbox. In React Toolbox, there's an input component that's used like this:
<Input type='text'
label='Name'
name='name' value={this.state.name}
onChange={this.handleChange.bind(this, 'name')}
maxLength={16 } />
I created a Reagent component around that React component like this:
(def input (reagent/adapt-react-class (.-Input js/ReactToolbox)))
so that I can use it like this:
[reagent-toolbox.core/input {:label "Name"
:name "name"
:type "text"
:value @name
:max-length 16
:on-change (fn [value event] (reset! name value))}]
But unlike the React version, in the Reagent version, each key press on the input causes the component to be re-rendered making the cursor jump to the end. You can experience that effect here: http://reagent-toolbox-docs.dashman.tech/input
Whan am I doing wrong? What am I missing?