We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>树组件</title> <script type='text/javascript' src="./dist/React.js"></script> <script type='text/javascript' src="./lib/ReactTestUtils.js"></script> <script type='text/javascript' src="./lib/babel.js"></script> </head> <body> <div>测试</div> <div id='example'></div> <script type='text/babel'> var container = document.getElementById("example") var div = container // var PropTypes = React.PropTypes if(!window.ReactDOM){ window.ReactDOM = window.React } var PropTypes = React.PropTypes var expect = function(a) { return { toBe: function(b) { console.log(a, "\nvs\n",b, a === b) } } } var app; var count = 0; class App extends React.Component { render() { if (this.props.stage === 1) { return <div><UnunmountableComponent /></div>; } else { return null; } } } class UnunmountableComponent extends React.Component { componentWillUnmount() { app.setState({}); count++; throw Error("always fails"); } render() { return <div>Hello {this.props.name}</div>; } } var container = document.createElement("div"); var setRef = ref => { if (ref) { app = ref; } }; // expect(function() { try{ ReactDOM.render(<App ref={setRef} stage={1} />, container); ReactDOM.render(<App ref={setRef} stage={2} />, container); // }).toThrow(); }catch(e){ console.log(e) } expect(count).toBe(1); </script> <pre> </pre> </body> </html>
The text was updated successfully, but these errors were encountered:
function discontinue(vnode){ if(!vnode){ return; } if(vnode.vtype > 1){ captureError(vnode.stateNode, "componentWillUnmount",[]); vnode.stateNode._hasError = true; } discontinue(vnode.child); discontinue(vnode.sibling); }
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: