Totally stumped here. I have a react component that passes a function, requestPatchAccount, to a child component:
import React from 'react';
import { Formik, Field, Form } from 'formik';
...
import { requestPatchAccount } from '../../../modules/account/actions';
const EditCustomerForm = ({customer, handleSubmit}) => {
return (
<Container>
<Formik
render={ () => (
<Form>
...
<AccountPaymentDetails
currentUser={customer}
requestPatchAccount={requestPatchAccount}
onSubmit={handleSubmit}
/>
The child component looks like this:
const AccountPaymentDetails = ({
currentUser,
requestPatchAccount,
...
}) => {
...
const setCCDetails = ccToken => {
const payload = { ccToken }
console.log(account_jwt);
console.log(payload);
requestPatchAccount(account_jwt, payload);
};
...
The two console.log statements show the correct information. However, requestPatchAccount never gets called. requestPatchAccount looks like this:
export const requestPatchAccount = (authToken, patches) => (
dispatch,
getState
) => {
console.log('i am here');
console.log(authToken);
console.log(patches);
...
};
Nothing ever gets logged to the console from inside requestPatchAccount. I've tried not passing it in as a prop but importing from the same file that has the child component, but I see the same behavior. Can someone explain what I'm doing wrong?
requestPatchToken(account_jwt, payload)(dispatch, getState)