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
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.
The text was updated successfully, but these errors were encountered:
I looked at mobx again - I don't believe the library will support it because of how mobx causes re-renders.
We can't really know why-did-you-render if you swallow the logic and cause a re-render on your own terms.
I mean, it's not a criticism, mobx is an amazing library. It's just not compatible with WDYR
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 aboveBigListPureComponent
, I stop getting anywhy-did-you-render
console notifications.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 fromReact.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.The text was updated successfully, but these errors were encountered: