Commit d9d931cd authored by Shen Chang's avatar Shen Chang

fix(Provider): <Provider> nesting error

parent e95cef41
import React from 'react';
import {bindLifecycle} from '../../../es';
import {Provider, KeepAlive} from '../../../es';
@bindLifecycle
class Content extends React.Component {
componentWillMount() {
console.log('A Content componentWillMount');
......@@ -40,7 +39,6 @@ class Content extends React.Component {
}
}
@bindLifecycle
class Test extends React.Component {
state = {
index: 0,
......@@ -84,7 +82,14 @@ class Test extends React.Component {
<div>
<div>This is a.</div>
<button onClick={this.handleClick}>click me({this.state.index})</button>
<Content />
{
this.state.index % 2 &&
<Provider>
<KeepAlive key="111">
<Content />
</KeepAlive>
</Provider>
}
</div>
);
}
......
......@@ -73,7 +73,6 @@ export default class KeepAliveProvider extends React.PureComponent<IKeepAlivePro
}
public componentWillUnmount() {
this.eventEmitter.clear();
this.existed = false;
document.body.removeChild(this.storeElement);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment