Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

A computed property name must be of type 'string', 'number', 'symbol', or 'any'.ts

$
0
0

I am using redux-saga and redux-actions with Typescript, like this:

 const moviesReducer = handleActions(      {        [actions.fetchMovies]: (state) => ({          ...state,          details: {...initialState.details},        }),        [actions.fetchMoviesSuccess]: (state, action) => {          return {            ...state,            details: {...state.details, ...action.payload},          };        },        [actions.fetchMoviesFailed]: (state, {payload}) => ({          ...state,          error: payload,        }),      },      initialState,    );

I have tried many answers from here:Typescript setState with computed property names

but nothing fits my case.

I got the error to go doing this:

[actions.fetchMovies.toString()]: (state) => ({  ...state,  details: {...initialState.details},}),

But I am afraid that may cause issues later onAny insight would be appreciated.

Thank you.


Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>