You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{render,Component,spread}from"mobx-jsx";functionBox(props){letel=document.createElement("div");spread(el,()=>props);returnel;}classAppextendsComponent{render(){return(<div><div><BoxonClick={()=>this.didClick()}>click me (this works)</Box></div><Box><BoxonClick={()=>this.didClick()}>click me (this doesnt work)</Box></Box></div>);}didClick(){console.log("did click");}}render(()=><App/>,document.getElementById("app"));
gets compiled as
classAppextendsComponent{render(){return(()=>{const_el$=_tmpl$.cloneNode(true),_el$2=_el$.firstChild;insert(_el$2,createComponent(Box,{onClick: ()=>this.didClick(),children: "click me (this works)"}));insert(_el$,createComponent(Box,{getchildren(){returncreateComponent(Box,{onClick: ()=>this.didClick(),children: "click me (this doesnt work)"});}}),null);return_el$;})();}didClick(){console.log('did click');}}
The text was updated successfully, but these errors were encountered:
On the following example, the second click function loses the scope and doesn't work. I presume is realted to this issue #31
live example https://codesandbox.io/s/mobx-nested-custom-component-with-spread-pfxo4?file=/index.js
gets compiled as
The text was updated successfully, but these errors were encountered: