📜  在一处破坏全局状态 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:20.045000             🧑  作者: Mango

代码示例1
const {
    bookings,
    isLoading,
    isUpdating,
    isLoaded,
    companies,
    isCompaniesLoaded,
    isCompaniesLoading,
    selectedCompany,
    selectedResource,
    isWeekView,
    startDate,
    endDate,
    showCancelledBookings,
    hideBufferTime,
  } = useSelector(state => ({
    bookings: state.booking.bookings,
    isLoading: state.booking.isLoading,
    isLoaded: state.booking.isLoaded,
    isUpdating: state.booking.isUpdating,

    companies: state.company.companies,
    isCompaniesLoaded: state.company.isLoaded,
    isCompaniesLoading: state.company.isLoading,

    selectedCompany: state.company.selectedCompany,
    selectedResource: state.company.selectedResource,
    isWeekView: state.booking.additionalParams.isWeekView,

    startDate: state.booking.additionalParams.startDate,
    endDate: state.booking.additionalParams.endDate,

    showCancelledBookings: state.booking.additionalParams.showCancelledBookings,
    hideBufferTime: state.booking.additionalParams.hideBufferTime,
  }), shallowEqual);