Skip to content

Commit

Permalink
Eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yadav committed Jul 27, 2019
1 parent 634b0b2 commit 03c6316
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
17 changes: 9 additions & 8 deletions example/UnMountAtNode.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import Brahmos, { Component, unmountComponentAtNode } from '../src';

export default class UnMountAtNode extends Component {

removeNode = () => {
setTimeout(() => {
unmountComponentAtNode( document.getElementById( 'unmount-node' ) );
unmountComponentAtNode(document.getElementById('unmount-node'));
}, 1000);
}
componentWillUnmount(){
console.log( 'component will unmount life cycle called!!' );

componentWillUnmount () {
console.log('component will unmount life cycle called!!');
}

render () {
return (
<div>
<p> Remove a mounted Brahmos component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing. Returns true if a component was unmounted and false if there was no component to unmount. </p>
<div>
<button onClick={ this.removeNode }> Remove node</button>
<p> Remove a mounted Brahmos component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing. Returns true if a component was unmounted and false if there was no component to unmount. </p>
<div>
<button onClick={ this.removeNode }> Remove node</button>
</div>
</div>
</div>
);
}
}
2 changes: 1 addition & 1 deletion example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import Brahmos, { render } from '../src';

render(<App />, document.getElementById('app'));

render( <UnMountAtNode/>, document.getElementById('unmount-node'))
render(<UnMountAtNode/>, document.getElementById('unmount-node'));
6 changes: 3 additions & 3 deletions src/unmountComponentAtNode.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import tearDown from './tearDown';

function unmountComponentAtNode( container ){
function unmountComponentAtNode (container) {
/**
* if container has a brahmosNode, it will be tear down.
*/
if( container.__brahmosNode ){
tearDown( container.__brahmosNode, { parentNode: container } );
if (container.__brahmosNode) {
tearDown(container.__brahmosNode, { parentNode: container });
return true;
}
return false;
Expand Down

0 comments on commit 03c6316

Please sign in to comment.