Я использовал аналогичный метод для входа в систему, как показано в App.js, но он не работает в моем компоненте загрузки. Я пытаюсь отправить действие из XMLupload.js

/ * * AppConstants * Каждое действие имеет соответствующий тип, который редуктор знает и воспринимает. * Чтобы избежать странных опечаток между редуктором и действиями, мы сохраняем их как * константы здесь. Мы ставим перед ними префикс ‘yourproject / YourComponent’, поэтому мы избегаем * редукторов, случайно выбирающих действия, которые они не должны делать. * * Используйте этот формат: * export const YOUR_ACTION_CONSTANT = ‘yourproject / YourContainer / YOUR_ACTION_CONSTANT’; * /

/App.js/

import React, { useEffect } from 'react'; import { Helmet } from 'react-helmet'; import styled from 'styled-components'; import { Switch, Route } from 'react-router-dom'; import './index.css' import FeaturePage from 'containers/FeaturePage/Loadable'; import NotFoundPage from 'containers/NotFoundPage/Loadable'; import Header from 'components/Header'; import Footer from 'components/Footer'; import Login from '../../components/Login/index'; import { useInjectSaga } from 'utils/injectSaga'; import { useInjectReducer } from 'utils/injectReducer'; import RoutePublic from '../../components/RoutePublic'; import RoutePrivate from '../../components/RoutePrivate'; import GlobalStyle from '../../global-styles'; import { connect } from 'react-redux'; import saga from './saga'; import reducer from './reducer'; import { login, xmlupload } from './actions'; import Dashboard from '../Dashboard/dashboard2'; import AdminMain from '../../components/Adminmain/Adminmain2'; import XmlUpload from '../../components/Reports/UploadField/XMLUpload'; const AppWrapper = styled.div` max-width: calc(768px   16px * 2); margin: 0 auto; display: flex; min-height: 100%; padding: 0 16px; flex-direction: column; `; const key = 'App'; function App({ handleLogin, isAuthenticated, UploadData }) { useInjectSaga({ key, saga }); useInjectReducer({ key, reducer }); return ( {amp}lt;div{amp}gt; {amp}lt;Switch{amp}gt; {amp}lt;RoutePublic isAuthenticated={isAuthenticated} path="/" exact component={Login} handleLogin={handleLogin} /{amp}gt; {amp}lt;RoutePrivate isAuthenticated={isAuthenticated} path="/dashboard" exact component={Dashboard} /{amp}gt; {amp}lt;RoutePrivate isAuthenticated={isAuthenticated} path="/Adminmain" exact component={XmlUpload} UploadData={UploadData} /{amp}gt; {amp}lt;Route path="" component={NotFoundPage} /{amp}gt; {amp}lt;/Switch{amp}gt; {amp}lt;/div {amp}gt; ); } function mapStateToProps(state) { let { App } = state; console.log(App) return { ...App }; } function mapDispatchToProps(dispatch) { return { handleLogin: (username, password) ={amp}gt; { dispatch(login(username, password)); }, UploadData: (file) ={amp}gt; { dispatch(xmlupload(file)); } }; } export default connect(mapStateToProps, mapDispatchToProps)(App); 

XMLUpload.js

 import React from 'react'; const XMLUpload = function ({ UploadData }) { const [file, setFile] = React.useState(null); return {amp}lt;div{amp}gt; Select a file: {amp}lt;input type="file" onChange={(e) ={amp}gt; setFile(e.target.value)} /{amp}gt; {console.log(file)} {amp}lt;input type="submit" onClick={(e) ={amp}gt; { e.preventDefault(); UploadData(file); }} /{amp}gt; {amp}lt;/div{amp}gt; } export default XMLUpload; 

action.js

 /* * App Actions * * Actions change things in your application * Since this boilerplate uses a uni-directional data flow, specifically redux, * we have these actions which are the only way your application interacts with * your application state. This guarantees that your state is up to date and nobody * messes it up weirdly somewhere. * * To add a new Action: * 1) Import your constant * 2) Add a function like this: * export function yourAction(var) { * return { type: YOUR_ACTION_CONSTANT, var: var } * } */ import { LOGIN, LOGIN_SUCCESS, ERROR, LOGOUT, XMLUPLOAD, XMLUPLOAD_SUCCESS } from './constants'; export function login(username, password) { return { type: LOGIN, username, password }; } export function loginSuccess(profile) { return { type: LOGIN_SUCCESS, profile, }; } export function error(error) { return { type: ERROR, error, }; } export function logout() { return { type: LOGOUT }; } export function xmlupload(file) { return { type: XMLUPLOAD, file }; } export function uploadSuccess(upfile) { return { type: XMLUPLOAD_SUCCESS, upfile, }; } 

constants.js

 export const LOGIN = 'assure/App/LOGIN'; export const LOGIN_SUCCESS = 'assure/App/LOGIN_SUCCESS'; export const ERROR = 'assure/App/ERROR'; export const PROFILE = 'assure/App/PROFILE' export const LOGOUT = 'assure/App/LOGOUT' export const XMLUPLOAD = 'assure/App/XMLUPLOAD'; export const XMLUPLOAD_SUCCESS = 'assure/App/XMLUPLOAD_SUCCESS'; 

я не могу найти решение, пожалуйста, помогите.