import React, { Component } from "react"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; import { Switch, Route } from "react-router-dom"; import UserInfo from "../components/userInfo"; import UserOrders from "../components/userOrders"; import { getUserOrders, getOrders } from "../actions/orders"; import { changeInputValueUserUserForm } from "../actions/auth"; import { putUser } from "../actions/user"; class UserContainer extends Component { componentDidMount() { this.props.getOrders({ doctors: this.props.doctors, services: this.props.services, users: this.props.users }); } // componentDidUpdate(){ // if(this.props.orders.length > 0 &&) // // console.log('did update', this.props.orders) // this.props.getUserOrders(this.props.currentUser) // } componentDidUpdate(prevProps) { if (this.props.orders.length > 0) if (prevProps.orders !== this.props.orders) this.props.getUserOrders(this.props.currentUser); } render() { const { currentUser, changeUserUserForm, changeInputValueUserUserForm, putUser, userOrdersArray } = this.props; return (