Created
October 21, 2018 05:05
-
-
Save agupta93/0db3b635f0073ecac96ada9e273eef9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import Table from './Table'; | |
import Card from './Card'; | |
class Controller extends Component { | |
state = { | |
view: 'list' | |
} | |
switchToCardView = () => { | |
this.setState({ | |
view: 'card' | |
}) | |
} | |
render() { | |
//... Some implementation | |
if (this.state.view === 'list') { | |
return <Table {...this.props} /> | |
} | |
return <Card {...this.props} /> | |
} | |
} | |
export default Controller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
class Table extends Component { | |
state = { | |
page: 0, | |
filters: [] | |
} | |
render() { | |
// ... Some implementation | |
} | |
} | |
export default Table; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment