Questions tagged [react-thunk]

65 questions
1
vote
1 answer

React js: TypeError: Object(...) is not a function

I tried to figure out what the error is, but I couldn't overcome it. Below are the error and the code. import React from 'react'; import ReactDOM from 'react-dom'; import { App } from './App'; import './index.css'; import * as serviceWorker from…
1
vote
1 answer

In redux-thunk with typescript, calling getState returns never

Code: type MyType = ThunkAction export const play = (): MyType => (dispatch, getState) => { const music = getState().music if(music.list.length !== 0) dispatch(play()) } In my…
1
vote
0 answers

(React-Native) Manifest is not a valid JSONObject or JSONArray

I am using expo for react-native development i want to use redux and redux-thunk in my react native application for that i create project using command expo init myproject and after that cd myproject. Now when i run expo start command it build…
1
vote
0 answers

Redux property increment not working, if call through child component

I have flatlist having images, videos. for images, I defined duration to show and then move to the next item in flatlist, but in case of the video once a video ended then move to next item. I am using Redux for currentlyPlayingIndex and flatlist…
1
vote
0 answers

NaN problem with react-redux and react-thunk

I'm trying to get data from api about currencies and I get error about NaN. I console.log(this.props) There it is: There is what I already did. In my actionTypes.js export const FETCH_DATA_BEGIN = 'FETCH_DATA_BEGIN'; export const FETCH_DATA_SUCCESS…
1
vote
1 answer

Sorting Data in React Redux

I am trying to create a sort button and while I have my data(menus) being sorted alphabetically after I added sort menus to the menu case and sort function to mapStateToProps in my main container, my question is what would be the easiest way to…
Jabba the Hutt
  • 410
  • 2
  • 9
1
vote
1 answer

React Redux Thunk Pass This.Props Methods in Action Creator

I am using react with react-stepzilla with Redux , Redux-thunk the problem is i want to use jumpToState(n) method inside action creator. but i am not able to access this method inside redux action creator file. Action File export const checkUser =…
Vikram
  • 21
  • 1
  • 4
1
vote
2 answers

React - Redux component not displaying array.length correctly despite component being rerendered on state change without mutating the state

Issue: I am using React with Redux store to manage my state. I want to display filters on a component. These filters will be returned from Tableau Javascript API. Based on the return from Tableau JavaScriptAPI I am updating the state in the store.…
1
vote
2 answers

What is the best practice for updating the local variables in redux-thunk after getting the response from api?

I have implemented the redux-thunk which works just fine in my react-native application. I have some 'this.counterValue', which value must be updated after getting the response from the api. As api fetch methods are implemented in another actions…
Kamalesh kunwar
  • 173
  • 2
  • 18
1
vote
1 answer

getState().property return undefined inside an async function

I'm using react-thunk with redux to implement a login function, but when I access the state using getState(), the property returns undefined. SystemState will set IsLogined and user when LoginSuccessed, I will use it later on for access token. But…
Ray Tang
  • 55
  • 1
  • 9
1
vote
1 answer

React component doesn't update after updating state with redux action

/keywordsActions import { UPDATE_KEYWORDS } from "./actionTypes"; import queryString from "query-string"; const keywordsArrayFromUrl = () => { const query = queryString.parse(window.location.search); if (query.keywords) { const…
1
vote
1 answer

async outside of componentDidMount in react

Can, in a react component, async be used outside componentDidMount() I have something like this async componentDidMount() { this.props.functionA(); } const mapDispachToProps = dispatch => { return { functionA: () =>…
OWADVL
  • 8,899
  • 6
  • 50
  • 66
1
vote
1 answer

React/Redux: Wait for reducer to get props

I have the following component which I use for navigation: import React, { Component } from "react"; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; class TabBar extends Component { constructor(props) { …
mrks
  • 4,642
  • 7
  • 38
  • 56
1
vote
1 answer

How to navigate to another screen after dispatch an action using redux

After dispatching an action to create a new object by the API, it returns it on mapStateToProps. On componentDidUpdate callback I am able to get the object mapped to props and open the detail screen passing it. The problem is that when I go back…
Roni Castro
  • 1,209
  • 14
  • 33
1
vote
0 answers

Creating Components based on multiple axios requests

I'm working on redux-thunk project which i need to reach out endpoint-1 to get which & how many components i need to show in a page. Then i'm required to use this return to reach out endpoint-2 and get the data with the parameters from the…
behcet ilhan
  • 21
  • 1
  • 4