profile
viewpoint

Ask questionsRefs - "object is not extensible"

I wanted to drop my string-based refs bindings and replace them with callback-based ones, however, when I tried to replace ref="email" with ref={ (ref) => this.refs.email = ref }, I received an error: TypeError: Can't add property email, object is not extensible.

I didn't find any informations about this in docs, but I found other issue in which @frederickfogerty did what I tried to do: ref={ c => this.refs['wrapper'] = c }

... and I assume that back in 22 Sep 2015 it worked, now it doesn't. Did something change and refs object became nonextensible? Is assigning refs manually through callbacks to this.refs considered a bad practice now?

facebook/react

Answer questions vishwa3

@vishwa3 you need to use this.query.current.value, not this.query.value

@satya164 :Thanks

useful!
source:https://uonfu.com/
answerer
vishwa3 India New to development with focus on learning and becoming better at ReactJs/Javascript.Love reading
Github User Rank List