reactjs - Only a ReactOwner can have refs. error using react-rails -


i'm getting error basic react-rails based app.

only reactowner can have refs. might adding ref component not created inside component's render method, or have multiple copies of react loaded

here component code refs are.

var newitem= react.createclass({     handleclick() {         var name    = this.refs.name.value;         var description = this.refs.description.value;         $.ajax({             url: '/api/v1/items',             type: 'post',             data: { item: { name: name, description: description } },             success: (response) => {                 console.log('it worked!', response);             }         });      },     render() {         return (                 <div>                     <input ref='name' placeholder='enter name of item' />                     <input ref='description' placeholder='enter description' />                     <button onclick={this.handleclick}>submit</button>                 </div>          )     } }); 

the error suggests either ref not created inside component, appears or multiple copies of react have been loaded don't think possible using react-rails gem.

if knows causing error i'd appreciate help. in advance!


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -