这是indexloc提供的服务,不要输入任何密码
Skip to content

Recursion on classes when a method is used as a prop (ie onClick) #31

@titoBouzout

Description

@titoBouzout

I stumble upon on a recursion issue, The following:

class App extends Component {
  onClick() {}
  render() {
    return <Box onClick={this.onClick} />;
  }
}

compiles to

class App extends _mobxJsx.Component {
    onClick() {}
    render() {
        return (0, _mobxJsx.createComponent)(Box, {
            get onClick() {
                return this.onClick
            }
        })
    }
}

Demo:
https://codesandbox.io/s/mobx-counter-context-bug-forked-wp9m9?file=/index.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions