mapStateToProps undefined state value, from react component Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!What is the difference between state and props in React?React js onClick can't pass value to methodCan you force a React component to rerender without calling setState?How to conditionally add attributes to React components?Understanding React-Redux and mapStateToProps()Redux state is undefined in mapStateToPropsReact component not updating with current state but mapStateToProps is updatingReact/Redux - Component State not updatingState is undefined in mapStateToPropsmapStateToProps undefined state value?

Why do early math courses focus on the cross sections of a cone and not on other 3D objects?

Would it be easier to apply for a UK visa if there is a host family to sponsor for you in going there?

What is an "asse" in Elizabethan English?

Google .dev domain strangely redirects to https

How do living politicians protect their readily obtainable signatures from misuse?

What is the difference between a "ranged attack" and a "ranged weapon attack"?

Most bit efficient text communication method?

Crossing US/Canada Border for less than 24 hours

Semigroups with no morphisms between them

Why does 14 CFR have skipped subparts in my ASA 2019 FAR/AIM book?

Should a wizard buy fine inks every time he want to copy spells into his spellbook?

Misunderstanding of Sylow theory

How many time has Arya actually used Needle?

Co-worker has annoying ringtone

How to report t statistic from R

How many morphisms from 1 to 1+1 can there be?

Dyck paths with extra diagonals from valleys (Laser construction)

What makes a man succeed?

What does it mean that physics no longer uses mechanical models to describe phenomena?

What to do with repeated rejections for phd position

Draw 4 of the same figure in the same tikzpicture

Drawing spherical mirrors

How long can equipment go unused before powering up runs the risk of damage?

What does Turing mean by this statement?



mapStateToProps undefined state value, from react component



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!What is the difference between state and props in React?React js onClick can't pass value to methodCan you force a React component to rerender without calling setState?How to conditionally add attributes to React components?Understanding React-Redux and mapStateToProps()Redux state is undefined in mapStateToPropsReact component not updating with current state but mapStateToProps is updatingReact/Redux - Component State not updatingState is undefined in mapStateToPropsmapStateToProps undefined state value?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















This is a new project I have taken on, first time working with someone elses code so I feel like I am missing a piece of the puzzle somewhere, the developer behind the codebase is a contractor and is not great with comms.



I have my react component here



 type TasksProps = TasksState.TasksState & MetadataState.MetadataState & typeof TasksState.actionCreators & RouteComponentProps<>;

class Tasks extends React.Component<TasksProps, >
constructor(props)
super(props);
this.setDates = this.setDates.bind(this);


setDates(event, picker)
this.setState( startDate: picker.startDate.toDate(), endDate: picker.endDate.toDate() );


public render()
return <div data-w-tab="Tasks" className="frame-pane w-tab-pane w--tab-active">
<div className="filter-container vertical">
<div className="filter-row">
<DateRangePicker startDate=moment((this.state as any).startDate) endDate=moment((this.state as any).endDate) onApply=this.setDates
ranges=
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'Last 12 Months': [moment().subtract(12, 'month'), moment()],
>
<div className="input-container">
<img src="../ClientApp/images/Calendar.png" width="16" alt="" className="calendar-icon" />
<div className="search-label">
moment((this.state as any).startDate).format("DD MMM YY") + " to " + moment((this.state as any).endDate).format("DD MMM YY")
</div>
</div>
</DateRangePicker>

</div>

</div>
</div>




function mapStateToProps(state)
return tasksData: state.tasks.tasksData, metadata: state.metadata.metadata ; // taskData undefined ??


export default connect(mapStateToProps as any, TasksState.actionCreators)(Tasks) as typeof Tasks;


Which talks to my reducer file



 export interface TasksState 
tasksData: any;


interface ReceiveTasksDataAction
type: 'RECEIVE_TASKS_DATA';
tasksData: any;


type KnownAction = ReceiveTasksDataAction;



export const actionCreators =
requestData: (notify: boolean, self: any): AppThunkAction<KnownAction> => (dispatch, getState) =>
$("#block-ui-container").css('visibility', 'visible');
$.ajax(
url: '/api/tasks',
method: "POST",
data:
StartDate: self.state.startDate.toDateString(),
EndDate: self.state.endDate.toDateString(),
OrchardId: $("#OrchardId").length > 0 ? $("#OrchardId").val() : "",
SiteId: $("#SiteId").length > 0 ? $("#SiteId").val() : "",
BlockId: $("#BlockId").length > 0 ? $("#BlockId").val() : "",
AreaId: $("#AreaId").length > 0 ? $("#AreaId").val() : "",
Row: $("#Row").length > 0 ? $("Row").val() : "",
TaskType: $("#TaskType").length > 0 ? $("#TaskType").val() : "",
SubType: $("#SubType").length > 0 ? $("#SubType").val() : "",
SubSubType: $("#SubSubType").length > 0 ? $("#SubSubType").val() : "",
IsComplete: $("#IsComplete").length > 0 ? $("#IsComplete").val() : "",
IsReopened: $("#IsReopened").length > 0 ? $("#IsReopened").val() : ""
,
headers: 'X-XSRF-Token': $('input[name="__RequestVerificationToken"]').val()
).then(function (response)
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: response.response
);

if (!self.props.metadata.Loading && (self.props as any).history.location.pathname.indexOf('payroll') >= 0)
$("#block-ui-container").css('visibility', 'hidden');

if (notify)
Utils.showToast('Filter applied', false);

).catch(function (error)
$("#block-ui-container").css('visibility', 'hidden');
if (error.status == 403)
Cookies.remove("LOGIN");
(self.props as any).history.push('/not-logged-in');

else
var status = error.status ? "Error " + error.status + ": " + error.statusText : error.toString();
Utils.showToast(status, true);
console.log(status);

);
,
clearData: (): AppThunkAction<KnownAction> => (dispatch, getState) =>
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: unloadedState.tasksData
);



const unloadedState: TasksState =
tasksData: null
;

export const reducer: Reducer<TasksState> = (state: TasksState, incomingAction: Action) =>
const action = incomingAction as KnownAction;
switch (action.type)
case 'RECEIVE_TASKS_DATA':
return
tasksData: action.tasksData
;

return state ;


Right now the react component is not rendering... the full error is



TypeError: Cannot read property 'tasksData' of undefined
at Function.mapStateToProps [as mapToProps] (Tasks.js:49)


Which is from the react component, however I think the error itself may be in the reducer file?










share|improve this question

















  • 1





    The question lacks stackoverflow.com/help/mcve which is necessary, especially if you have bulky code that requires some time investment to analyze. In the code you posted there's no place where you set state tasks or metadata. however I think the error itself may be in the reducer file? - likely yes. Depends on whether it's the only reducer and how it's used.

    – estus
    Mar 8 at 21:59












  • My guess, and it is only a guess based on the code that I can see, is that state.tasks.tasksData should be state.tasksData. The error is saying that state.tasks is undefined and the only reducer I can see assigns the action payload to tasksData. Whether this reducer is combined with others is impossible to know from this information.

    – Matt
    Mar 8 at 22:21











  • @estus Found the second reducer file, the fix was simply importing the new component and its reducer. Thanks guys

    – invrt
    Mar 8 at 22:37











  • @Matt It's working now, see the above reply

    – invrt
    Mar 8 at 22:37











  • If you don't already, use redux dev tools to inspect state. Makes life so much easier.

    – Markus
    Mar 9 at 0:08

















0















This is a new project I have taken on, first time working with someone elses code so I feel like I am missing a piece of the puzzle somewhere, the developer behind the codebase is a contractor and is not great with comms.



I have my react component here



 type TasksProps = TasksState.TasksState & MetadataState.MetadataState & typeof TasksState.actionCreators & RouteComponentProps<>;

class Tasks extends React.Component<TasksProps, >
constructor(props)
super(props);
this.setDates = this.setDates.bind(this);


setDates(event, picker)
this.setState( startDate: picker.startDate.toDate(), endDate: picker.endDate.toDate() );


public render()
return <div data-w-tab="Tasks" className="frame-pane w-tab-pane w--tab-active">
<div className="filter-container vertical">
<div className="filter-row">
<DateRangePicker startDate=moment((this.state as any).startDate) endDate=moment((this.state as any).endDate) onApply=this.setDates
ranges=
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'Last 12 Months': [moment().subtract(12, 'month'), moment()],
>
<div className="input-container">
<img src="../ClientApp/images/Calendar.png" width="16" alt="" className="calendar-icon" />
<div className="search-label">
moment((this.state as any).startDate).format("DD MMM YY") + " to " + moment((this.state as any).endDate).format("DD MMM YY")
</div>
</div>
</DateRangePicker>

</div>

</div>
</div>




function mapStateToProps(state)
return tasksData: state.tasks.tasksData, metadata: state.metadata.metadata ; // taskData undefined ??


export default connect(mapStateToProps as any, TasksState.actionCreators)(Tasks) as typeof Tasks;


Which talks to my reducer file



 export interface TasksState 
tasksData: any;


interface ReceiveTasksDataAction
type: 'RECEIVE_TASKS_DATA';
tasksData: any;


type KnownAction = ReceiveTasksDataAction;



export const actionCreators =
requestData: (notify: boolean, self: any): AppThunkAction<KnownAction> => (dispatch, getState) =>
$("#block-ui-container").css('visibility', 'visible');
$.ajax(
url: '/api/tasks',
method: "POST",
data:
StartDate: self.state.startDate.toDateString(),
EndDate: self.state.endDate.toDateString(),
OrchardId: $("#OrchardId").length > 0 ? $("#OrchardId").val() : "",
SiteId: $("#SiteId").length > 0 ? $("#SiteId").val() : "",
BlockId: $("#BlockId").length > 0 ? $("#BlockId").val() : "",
AreaId: $("#AreaId").length > 0 ? $("#AreaId").val() : "",
Row: $("#Row").length > 0 ? $("Row").val() : "",
TaskType: $("#TaskType").length > 0 ? $("#TaskType").val() : "",
SubType: $("#SubType").length > 0 ? $("#SubType").val() : "",
SubSubType: $("#SubSubType").length > 0 ? $("#SubSubType").val() : "",
IsComplete: $("#IsComplete").length > 0 ? $("#IsComplete").val() : "",
IsReopened: $("#IsReopened").length > 0 ? $("#IsReopened").val() : ""
,
headers: 'X-XSRF-Token': $('input[name="__RequestVerificationToken"]').val()
).then(function (response)
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: response.response
);

if (!self.props.metadata.Loading && (self.props as any).history.location.pathname.indexOf('payroll') >= 0)
$("#block-ui-container").css('visibility', 'hidden');

if (notify)
Utils.showToast('Filter applied', false);

).catch(function (error)
$("#block-ui-container").css('visibility', 'hidden');
if (error.status == 403)
Cookies.remove("LOGIN");
(self.props as any).history.push('/not-logged-in');

else
var status = error.status ? "Error " + error.status + ": " + error.statusText : error.toString();
Utils.showToast(status, true);
console.log(status);

);
,
clearData: (): AppThunkAction<KnownAction> => (dispatch, getState) =>
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: unloadedState.tasksData
);



const unloadedState: TasksState =
tasksData: null
;

export const reducer: Reducer<TasksState> = (state: TasksState, incomingAction: Action) =>
const action = incomingAction as KnownAction;
switch (action.type)
case 'RECEIVE_TASKS_DATA':
return
tasksData: action.tasksData
;

return state ;


Right now the react component is not rendering... the full error is



TypeError: Cannot read property 'tasksData' of undefined
at Function.mapStateToProps [as mapToProps] (Tasks.js:49)


Which is from the react component, however I think the error itself may be in the reducer file?










share|improve this question

















  • 1





    The question lacks stackoverflow.com/help/mcve which is necessary, especially if you have bulky code that requires some time investment to analyze. In the code you posted there's no place where you set state tasks or metadata. however I think the error itself may be in the reducer file? - likely yes. Depends on whether it's the only reducer and how it's used.

    – estus
    Mar 8 at 21:59












  • My guess, and it is only a guess based on the code that I can see, is that state.tasks.tasksData should be state.tasksData. The error is saying that state.tasks is undefined and the only reducer I can see assigns the action payload to tasksData. Whether this reducer is combined with others is impossible to know from this information.

    – Matt
    Mar 8 at 22:21











  • @estus Found the second reducer file, the fix was simply importing the new component and its reducer. Thanks guys

    – invrt
    Mar 8 at 22:37











  • @Matt It's working now, see the above reply

    – invrt
    Mar 8 at 22:37











  • If you don't already, use redux dev tools to inspect state. Makes life so much easier.

    – Markus
    Mar 9 at 0:08













0












0








0








This is a new project I have taken on, first time working with someone elses code so I feel like I am missing a piece of the puzzle somewhere, the developer behind the codebase is a contractor and is not great with comms.



I have my react component here



 type TasksProps = TasksState.TasksState & MetadataState.MetadataState & typeof TasksState.actionCreators & RouteComponentProps<>;

class Tasks extends React.Component<TasksProps, >
constructor(props)
super(props);
this.setDates = this.setDates.bind(this);


setDates(event, picker)
this.setState( startDate: picker.startDate.toDate(), endDate: picker.endDate.toDate() );


public render()
return <div data-w-tab="Tasks" className="frame-pane w-tab-pane w--tab-active">
<div className="filter-container vertical">
<div className="filter-row">
<DateRangePicker startDate=moment((this.state as any).startDate) endDate=moment((this.state as any).endDate) onApply=this.setDates
ranges=
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'Last 12 Months': [moment().subtract(12, 'month'), moment()],
>
<div className="input-container">
<img src="../ClientApp/images/Calendar.png" width="16" alt="" className="calendar-icon" />
<div className="search-label">
moment((this.state as any).startDate).format("DD MMM YY") + " to " + moment((this.state as any).endDate).format("DD MMM YY")
</div>
</div>
</DateRangePicker>

</div>

</div>
</div>




function mapStateToProps(state)
return tasksData: state.tasks.tasksData, metadata: state.metadata.metadata ; // taskData undefined ??


export default connect(mapStateToProps as any, TasksState.actionCreators)(Tasks) as typeof Tasks;


Which talks to my reducer file



 export interface TasksState 
tasksData: any;


interface ReceiveTasksDataAction
type: 'RECEIVE_TASKS_DATA';
tasksData: any;


type KnownAction = ReceiveTasksDataAction;



export const actionCreators =
requestData: (notify: boolean, self: any): AppThunkAction<KnownAction> => (dispatch, getState) =>
$("#block-ui-container").css('visibility', 'visible');
$.ajax(
url: '/api/tasks',
method: "POST",
data:
StartDate: self.state.startDate.toDateString(),
EndDate: self.state.endDate.toDateString(),
OrchardId: $("#OrchardId").length > 0 ? $("#OrchardId").val() : "",
SiteId: $("#SiteId").length > 0 ? $("#SiteId").val() : "",
BlockId: $("#BlockId").length > 0 ? $("#BlockId").val() : "",
AreaId: $("#AreaId").length > 0 ? $("#AreaId").val() : "",
Row: $("#Row").length > 0 ? $("Row").val() : "",
TaskType: $("#TaskType").length > 0 ? $("#TaskType").val() : "",
SubType: $("#SubType").length > 0 ? $("#SubType").val() : "",
SubSubType: $("#SubSubType").length > 0 ? $("#SubSubType").val() : "",
IsComplete: $("#IsComplete").length > 0 ? $("#IsComplete").val() : "",
IsReopened: $("#IsReopened").length > 0 ? $("#IsReopened").val() : ""
,
headers: 'X-XSRF-Token': $('input[name="__RequestVerificationToken"]').val()
).then(function (response)
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: response.response
);

if (!self.props.metadata.Loading && (self.props as any).history.location.pathname.indexOf('payroll') >= 0)
$("#block-ui-container").css('visibility', 'hidden');

if (notify)
Utils.showToast('Filter applied', false);

).catch(function (error)
$("#block-ui-container").css('visibility', 'hidden');
if (error.status == 403)
Cookies.remove("LOGIN");
(self.props as any).history.push('/not-logged-in');

else
var status = error.status ? "Error " + error.status + ": " + error.statusText : error.toString();
Utils.showToast(status, true);
console.log(status);

);
,
clearData: (): AppThunkAction<KnownAction> => (dispatch, getState) =>
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: unloadedState.tasksData
);



const unloadedState: TasksState =
tasksData: null
;

export const reducer: Reducer<TasksState> = (state: TasksState, incomingAction: Action) =>
const action = incomingAction as KnownAction;
switch (action.type)
case 'RECEIVE_TASKS_DATA':
return
tasksData: action.tasksData
;

return state ;


Right now the react component is not rendering... the full error is



TypeError: Cannot read property 'tasksData' of undefined
at Function.mapStateToProps [as mapToProps] (Tasks.js:49)


Which is from the react component, however I think the error itself may be in the reducer file?










share|improve this question














This is a new project I have taken on, first time working with someone elses code so I feel like I am missing a piece of the puzzle somewhere, the developer behind the codebase is a contractor and is not great with comms.



I have my react component here



 type TasksProps = TasksState.TasksState & MetadataState.MetadataState & typeof TasksState.actionCreators & RouteComponentProps<>;

class Tasks extends React.Component<TasksProps, >
constructor(props)
super(props);
this.setDates = this.setDates.bind(this);


setDates(event, picker)
this.setState( startDate: picker.startDate.toDate(), endDate: picker.endDate.toDate() );


public render()
return <div data-w-tab="Tasks" className="frame-pane w-tab-pane w--tab-active">
<div className="filter-container vertical">
<div className="filter-row">
<DateRangePicker startDate=moment((this.state as any).startDate) endDate=moment((this.state as any).endDate) onApply=this.setDates
ranges=
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'Last 12 Months': [moment().subtract(12, 'month'), moment()],
>
<div className="input-container">
<img src="../ClientApp/images/Calendar.png" width="16" alt="" className="calendar-icon" />
<div className="search-label">
moment((this.state as any).startDate).format("DD MMM YY") + " to " + moment((this.state as any).endDate).format("DD MMM YY")
</div>
</div>
</DateRangePicker>

</div>

</div>
</div>




function mapStateToProps(state)
return tasksData: state.tasks.tasksData, metadata: state.metadata.metadata ; // taskData undefined ??


export default connect(mapStateToProps as any, TasksState.actionCreators)(Tasks) as typeof Tasks;


Which talks to my reducer file



 export interface TasksState 
tasksData: any;


interface ReceiveTasksDataAction
type: 'RECEIVE_TASKS_DATA';
tasksData: any;


type KnownAction = ReceiveTasksDataAction;



export const actionCreators =
requestData: (notify: boolean, self: any): AppThunkAction<KnownAction> => (dispatch, getState) =>
$("#block-ui-container").css('visibility', 'visible');
$.ajax(
url: '/api/tasks',
method: "POST",
data:
StartDate: self.state.startDate.toDateString(),
EndDate: self.state.endDate.toDateString(),
OrchardId: $("#OrchardId").length > 0 ? $("#OrchardId").val() : "",
SiteId: $("#SiteId").length > 0 ? $("#SiteId").val() : "",
BlockId: $("#BlockId").length > 0 ? $("#BlockId").val() : "",
AreaId: $("#AreaId").length > 0 ? $("#AreaId").val() : "",
Row: $("#Row").length > 0 ? $("Row").val() : "",
TaskType: $("#TaskType").length > 0 ? $("#TaskType").val() : "",
SubType: $("#SubType").length > 0 ? $("#SubType").val() : "",
SubSubType: $("#SubSubType").length > 0 ? $("#SubSubType").val() : "",
IsComplete: $("#IsComplete").length > 0 ? $("#IsComplete").val() : "",
IsReopened: $("#IsReopened").length > 0 ? $("#IsReopened").val() : ""
,
headers: 'X-XSRF-Token': $('input[name="__RequestVerificationToken"]').val()
).then(function (response)
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: response.response
);

if (!self.props.metadata.Loading && (self.props as any).history.location.pathname.indexOf('payroll') >= 0)
$("#block-ui-container").css('visibility', 'hidden');

if (notify)
Utils.showToast('Filter applied', false);

).catch(function (error)
$("#block-ui-container").css('visibility', 'hidden');
if (error.status == 403)
Cookies.remove("LOGIN");
(self.props as any).history.push('/not-logged-in');

else
var status = error.status ? "Error " + error.status + ": " + error.statusText : error.toString();
Utils.showToast(status, true);
console.log(status);

);
,
clearData: (): AppThunkAction<KnownAction> => (dispatch, getState) =>
dispatch(
type: 'RECEIVE_TASKS_DATA',
tasksData: unloadedState.tasksData
);



const unloadedState: TasksState =
tasksData: null
;

export const reducer: Reducer<TasksState> = (state: TasksState, incomingAction: Action) =>
const action = incomingAction as KnownAction;
switch (action.type)
case 'RECEIVE_TASKS_DATA':
return
tasksData: action.tasksData
;

return state ;


Right now the react component is not rendering... the full error is



TypeError: Cannot read property 'tasksData' of undefined
at Function.mapStateToProps [as mapToProps] (Tasks.js:49)


Which is from the react component, however I think the error itself may be in the reducer file?







reactjs redux reducers






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 21:49









invrtinvrt

728




728







  • 1





    The question lacks stackoverflow.com/help/mcve which is necessary, especially if you have bulky code that requires some time investment to analyze. In the code you posted there's no place where you set state tasks or metadata. however I think the error itself may be in the reducer file? - likely yes. Depends on whether it's the only reducer and how it's used.

    – estus
    Mar 8 at 21:59












  • My guess, and it is only a guess based on the code that I can see, is that state.tasks.tasksData should be state.tasksData. The error is saying that state.tasks is undefined and the only reducer I can see assigns the action payload to tasksData. Whether this reducer is combined with others is impossible to know from this information.

    – Matt
    Mar 8 at 22:21











  • @estus Found the second reducer file, the fix was simply importing the new component and its reducer. Thanks guys

    – invrt
    Mar 8 at 22:37











  • @Matt It's working now, see the above reply

    – invrt
    Mar 8 at 22:37











  • If you don't already, use redux dev tools to inspect state. Makes life so much easier.

    – Markus
    Mar 9 at 0:08












  • 1





    The question lacks stackoverflow.com/help/mcve which is necessary, especially if you have bulky code that requires some time investment to analyze. In the code you posted there's no place where you set state tasks or metadata. however I think the error itself may be in the reducer file? - likely yes. Depends on whether it's the only reducer and how it's used.

    – estus
    Mar 8 at 21:59












  • My guess, and it is only a guess based on the code that I can see, is that state.tasks.tasksData should be state.tasksData. The error is saying that state.tasks is undefined and the only reducer I can see assigns the action payload to tasksData. Whether this reducer is combined with others is impossible to know from this information.

    – Matt
    Mar 8 at 22:21











  • @estus Found the second reducer file, the fix was simply importing the new component and its reducer. Thanks guys

    – invrt
    Mar 8 at 22:37











  • @Matt It's working now, see the above reply

    – invrt
    Mar 8 at 22:37











  • If you don't already, use redux dev tools to inspect state. Makes life so much easier.

    – Markus
    Mar 9 at 0:08







1




1





The question lacks stackoverflow.com/help/mcve which is necessary, especially if you have bulky code that requires some time investment to analyze. In the code you posted there's no place where you set state tasks or metadata. however I think the error itself may be in the reducer file? - likely yes. Depends on whether it's the only reducer and how it's used.

– estus
Mar 8 at 21:59






The question lacks stackoverflow.com/help/mcve which is necessary, especially if you have bulky code that requires some time investment to analyze. In the code you posted there's no place where you set state tasks or metadata. however I think the error itself may be in the reducer file? - likely yes. Depends on whether it's the only reducer and how it's used.

– estus
Mar 8 at 21:59














My guess, and it is only a guess based on the code that I can see, is that state.tasks.tasksData should be state.tasksData. The error is saying that state.tasks is undefined and the only reducer I can see assigns the action payload to tasksData. Whether this reducer is combined with others is impossible to know from this information.

– Matt
Mar 8 at 22:21





My guess, and it is only a guess based on the code that I can see, is that state.tasks.tasksData should be state.tasksData. The error is saying that state.tasks is undefined and the only reducer I can see assigns the action payload to tasksData. Whether this reducer is combined with others is impossible to know from this information.

– Matt
Mar 8 at 22:21













@estus Found the second reducer file, the fix was simply importing the new component and its reducer. Thanks guys

– invrt
Mar 8 at 22:37





@estus Found the second reducer file, the fix was simply importing the new component and its reducer. Thanks guys

– invrt
Mar 8 at 22:37













@Matt It's working now, see the above reply

– invrt
Mar 8 at 22:37





@Matt It's working now, see the above reply

– invrt
Mar 8 at 22:37













If you don't already, use redux dev tools to inspect state. Makes life so much easier.

– Markus
Mar 9 at 0:08





If you don't already, use redux dev tools to inspect state. Makes life so much easier.

– Markus
Mar 9 at 0:08












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071482%2fmapstatetoprops-undefined-state-value-from-react-component%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071482%2fmapstatetoprops-undefined-state-value-from-react-component%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович