import { useParams } from 'react-router-dom';
import Order from './order';
import Fetcher from '../shared/fetches/fetcher';
import { fetchOrder } from '../../redux/actions/order';

function OrderContainer() {
  const { orderId } = useParams();

  return (
    <Fetcher action={fetchOrder.bind(null, orderId)} stateSelector={state => state.order}>
      {order => <Order order={order} />}
    </Fetcher>
  );
}

export default OrderContainer;
