I started use only 'este.react' from este.js framework, because there is well resolved compiling app with Closure Compiler's advanced optimizations. It works like a charm, except one weird behaviour. When I have component with defined handler method for event (eg. onClick) and I want to call manually from any other component's method, it doesn't work (method is never called). Example:
MyComponent = este.react.create (`/** @lends {React.ReactComponent.prototype} */`)
###*
* @param {Event=} ev
###
handleClick: (ev) ->
# handling of click event
###*
* @param {Event} ev
###
handleDifferentClick: (ev) ->
# do something different
@handleClick() # This call doesn't work...
render: ->
@div { 'className': 'parentDiv' }, [
@button { 'name': 'btn1', 'onClick': @handleClick}, 'Button 1'
@button { 'name': 'btn2', 'onClick': @handleDifferentClick}, 'Button 2'
]
Calling `handleClick` inside `handleDifferentWork` doesn't work, but when I would remove Button 1 so `handleClick` won't be handler function, it works. Resolution of this problem is enclose function name with quotes at definition and with brackets when calling it. But it doesn't look well and adds it bytes to destination file since full method name is used. Is there something what I could do better?