How to make AJAX request in redux

For all I know, I have to write request in action create. How to use a promise in action for submitting a request? I am getting data in action. Then new state is created in reducer. Bind action...

how to pass value with bindActionCreators?

Until now I've been dealing with two kind of mapDispatchToProps : One : function mapDispatchToProps(dispatch) { return { fetchgadata: bindActionCreators(fetchgadata, dispatch) }; } Two...

How does a redux connected component know when to re-render?

I'm probably missing something very obvious and would like to clear myself. Here's my understanding. In a naive react component, we have states & props. Updating state with setState re-renders the...

syntax highlighting for react code in sublime

I'm started writing some basic React code in sublime text. Here is what my syntax highlighting looks like. Its partly highlighted. Is there any suggested sublime plugin i can use to see a complete...

In React ES6, why does the input field lose focus after typing a character?

In my component below, the input field loses focus after typing a character. While using Chrome's Inspector, it looks like the whole form is being re-rendered instead of just the value attribute...

Error: Reducer "getSelectedItem" returned undefined during initialization

I had some hard times the last days having Redux working with my React App. I needed to have a component "Item" to render() based on the current selectedItemId from another ItemSelector component....

Redux & React Router: Combing dispatch and navigation (history.push)

I'm a bit clueless as to how to use React Router's history.push('/route') with Redux. In other words, if you connect a component with Redux's mapDispatchToProps, how do you put...

Actions must be plain objects while using redux-thunk

I am implementing asynchronous action creators using react-redux and redux-thunk. However, I am getting the following error message: Uncaught Error: Actions must be plain objects. Use custom...

Handle unsuccessful Ajax calls with Redux and Redux Thunk in React

For my React components, I use Redux (react-redux) and Redux Thunk to maintain the app state. There's a ShowGroup component that retrieves a group from the backend. If the group doesn't exist (or...

Using .map() helper with bootstrap <Col sm="4" /> layout in React

I'm using also ReduxLazyScroll for infinite scroll effect and it worked but before it was just ul -> li list. Now I want my app to generate 3 cards one beside another in bootstrap-grid style, like...

How do you test a redux connected react component by exporting it as a PureComponent?

I've been looking for a solution that I know works but syntax is tripping me up. Here's the scenario: You have a redux connected component that is exported like so: export default...

Pass parameters to mapDispatchToProps()

I can't lie, i'm a bit confused about react-redux. I think lot of the actions require parameters (for an example deleting items from the store), but even if i'm still reading about how to dispatch...

Why state returned from my reducer is an empty object??(React-Redux)

I have a problem in my redux reducer, it does not return expected state after dispatching 'FETCH_BOOKS' action, it returns an empty object instead of an object of state which is books that is...

Accessing props from object outside of React component

In my React component, I use a third-party component that needs to be initialized. Up to this point, I handled this outside of the class -- see below but I now need to access some of the props...

Ant Design: Vertical submenu pop up grow from bottom to top

Is it possible to display the popup of a vertical submenu "the other way around" ? I have one SubMenu item in a fixed Sidebar at the bottom of my page. It contains links for the users profile and...

redux-thunk: Property 'type' missing when calling action through store.dispatch()

I have found similar issues online but no solution for when calling a redux-thunk Action through store.dispatch(). I have the following action: export class DBActions { static startDatabase():...

How to read data from props to state of Modal Form (controlled) from parent component in React?

I have this hierarchy of components: - Page -- Table -- ModalForm -- Fab By clicking on Fab (rounded button in right-bottom corner), I open blank modalForm (material-ui Dialog component) for...

How to change a value inside array of object in Redux

I have stored an array of object in Redux State and inside each object there is a key named price. Now when I increment the quantity button I need to access the object that has the key inside...

React Navigation - pop() go's back to root rather than previous page

I am trying to add a back buttons into a bespoke sidemenu component. Here is my navigation.js setup: import { createAppContainer, createStackNavigator, createDrawerNavigator } from...

Keyboard dismisses while typing TextInput in nested functional component React Native

I have this strange issue, keyboard keeps closing while typing when TextInput is placed inside Child Functional Component. This issue does not exist if TextInput is placed directly under Parent...

Redux state resets itself on route change (I think)

I am successfully updating my 'global state' with Redux. I change the language index of my app using an action and it changes in the component; however, when I redirect to another component the...

How to run callback function after mapDispatchToProps OR update the props, using react redux?

Here is an example of it. My Code is: const mapDispatchToProps = dispatch => ({ onChangeHandler: (name,value) => dispatch({ type: "REGISTRATION", key: name, value }) }); But I need...

not able to add items to cart from product page using react redux

I have listed out some products in product list page. I am not able to add product in my cart. It is showing error in my reducer code. Here is my code. action export const addToCart= id =>({ type:...

React Router with custom history not working

When I was using BrowserRouter from react-router-dom, My Routes were working. But to use custom history, I replaced BrowserRouter with Router from react-router. After that my Route components are...

UseEffect not triggering when used with MaterialTopTabNavigator

This is my first time using this platform to ask questions so please pardon me if my question does not seem well developed. brief introduction what I am trying to achieve is a dynamic Tab...

how can i remove data in array from firebase by React native?

I'm making SNS app with React Native & Firebase. I can create a comments in array of each Post, and show it as a Flatlist. But I don't know how to remove each comment. Please let me know where to...

Can't dispatch typescript action for class based component

I am trying to use this boilerplate for my react typescript project. I am unable to configure right type of actions. It was easy with JavaScript. But I am new to TypeScript. I want to know why my...

× TypeError: Cannot read properties of undefined (reading 'getState')

I am a beginner learning react and redux. I wrote this demo about how to use connect.js in redux. Searching this kind of question but there is no right answer for my code. I got a undefined...

React-Redux migration from 5.x to 7.x broke `connect`

I'm trying to upgrade from react-redux (https://www.npmjs.com/package/react-redux) to 7.x from 5.x, to use hooks and have reached some breaking changes with the connect() function. It keeps giving...

Error: Absolute route path "/" nested under path "/app" is not valid

I suddenly get this error and not sure why. I did not change the "react-router-dom": "^6.0.0-beta.4" version. But the "react-dom": "^16.8.4"" vad changed to "react-dom": "^16.13.1", Dunno if that...