Wrapper.tsx 843 B

123456789101112131415161718192021222324252627282930313233
  1. import React, { PureComponent } from 'react';
  2. import Explore from './Explore';
  3. export default class Wrapper extends PureComponent<any, any> {
  4. state = {
  5. initialState: null,
  6. split: false,
  7. };
  8. handleChangeSplit = (split, initialState) => {
  9. this.setState({ split, initialState });
  10. };
  11. render() {
  12. // State overrides for props from first Explore
  13. const { initialState, split } = this.state;
  14. return (
  15. <div className="explore-wrapper">
  16. <Explore {...this.props} position="left" onChangeSplit={this.handleChangeSplit} split={split} />
  17. {split ? (
  18. <Explore
  19. {...this.props}
  20. initialState={initialState}
  21. onChangeSplit={this.handleChangeSplit}
  22. position="right"
  23. split={split}
  24. />
  25. ) : null}
  26. </div>
  27. );
  28. }
  29. }