A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/welldone-software/why-did-you-render/issues/162 below:

Mobx Support · Issue #162 · welldone-software/why-did-you-render · GitHub

Is this library compatible with Mobx?

I'm trying to adapt the why-did-you-render official example to run with Mobx 5.
As soon as I put a @observer decorator above BigListPureComponent, I stop getting any why-did-you-render console notifications.

@observer
class BigListPureComponent extends React.PureComponent {
  static whyDidYouRender = true;
  render() {
    console.log(
      "BigListPureComponent Re-Render! - We don't want to get here too often."
    );
    return (
      <div style={this.props.style}>
        <h2>BigListPureComponent</h2>
        <div>
          {times(3000).map(n => (
            <div key={n}>Element #{n}</div>
          ))}
        </div>
      </div>
    );
  }
}

However, I still get the regular console.log notification, so it's clearly still being rendered unnecessarily. I've tried multiple permutations such as extending from React.Component, but as soon as I add in @observer it stops working.

Is there an example of this library working with Mobx or are they incompatible? I don't see any mention in the docs one way or the other. Thanks.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4