Sha256: ca971d65ee095ca0edd2fda766a0d07881d525435b54d8b16eb3d3f954e555c7
Contents?: true
Size: 848 Bytes
Versions: 7
Compression:
Stored size: 848 Bytes
Contents
import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import { useSelector, useDispatch } from 'react-redux'; import Cycle from './Cycle'; import { selectCycle, selectStatus, } from './CycleSelectors'; import { getCycle, moveWindow, } from './CycleActions'; const WrappedCycle = ({ id }) => { const dispatch = useDispatch(); const cycle = useSelector(selectCycle); const status = useSelector(selectStatus); const updateWindow = (window) => { dispatch(moveWindow(window)); }; useEffect(() => { dispatch(getCycle(id)); }, [dispatch]); return (<Cycle {...cycle} moveWindow={updateWindow} status={status} />); }; WrappedCycle.propTypes = { id: PropTypes.number.isRequired, locale: PropTypes.string, }; WrappedCycle.defaultProps = { locale: 'en-US', }; export default WrappedCycle;
Version data entries
7 entries across 7 versions & 1 rubygems