import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Transition } from 'react-transition-group'; import './widget.scss'; class Widget extends Component { state = { opened: false, showDock: true, } handleToggleOpen = () => { this.setState((prev) => { let { showDock } = prev; if (!prev.opened) { showDock = false; } return { showDock, opened: !prev.opened, }; }); } handleWidgetExit = () => { this.setState({ showDock: true, }); } renderBody = () => { if (this.state.showDock) { return ( ^ OPEN ^ ); } return ''; } render() { const body = this.renderBody(); return (