render: map composing (working)

This commit is contained in:
muerwre 2018-11-27 17:18:15 +07:00
parent 2eb398ef6b
commit 4747c918e2
9 changed files with 122 additions and 7 deletions

View file

@ -9,17 +9,30 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { hot } from 'react-hot-loader';
import { Renderer } from '$components/renderer/Renderer';
import { hideRenderer } from '$redux/user/actions';
const Component = () => (
type Props = {
renderer_active: Boolean,
hideRenderer: Function,
}
const Component = (props: Props) => (
<div>
<Fills />
<UserLocation />
<UserPanel />
<EditorPanel />
{
props.renderer_active &&
<Renderer onClick={props.hideRenderer} />
}
</div>
);
const mapStateToProps = () => ({});
const mapDispatchToProps = dispatch => bindActionCreators({}, dispatch);
const mapStateToProps = ({ user }) => ({
renderer_active: user.renderer_active
});
const mapDispatchToProps = dispatch => bindActionCreators({ hideRenderer }, dispatch);
export const App = connect(mapStateToProps, mapDispatchToProps)(hot(module)(Component));