Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
¿Definiendo el tipo a history.push() que se ha pasado como carga útil a la saga usando mecanografiado?

He usado { useHistory } from react-router-dom en el componente de reacción. Y al hacer clic en el botón, intento pasar la instancia del historial como carga útil a la saga a través de action.ts

componente.tsx

 import React from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; import {recievingHistoryAsPayload } from 'store/actions'; const Component: React.FC = () => { const history = useHistory(); const dispatch = useDispatch(); const sendHistoryObj = () => { dispatch(recievingHistoryAsPayload({ payload: history })); }; return ( <Button onClick={sendHistoryObj} /> ); }; export default Component;

acción.ts

 export const recievingHistoryAsPayload = createAction( Types.RECEIVING_HISTORY_AS_PAYLOAD, (data) => data );

saga.ts

 export function* recievingHistoryAsPayloadSaga(action: any): Generator { yield call(action?.payload?.push, '/'); }

en saga.ts, para la carga útil de la acción, eslint está lanzando una guerra con el mensaje Argument 'action' should be typed with a non-any type.

Qué tipo debe definirse para la acción en saga.ts

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!