Skip to main content

All Questions

Filter by
Sorted by
Tagged with
196 votes
10 answers
221k views

How do I add an element to array in reducer of React native redux?

How do I add elements in my array arr[] of redux state in reducer? I am doing this- import {ADD_ITEM} from '../Actions/UserActions' const initialUserState = { arr:[] } export default function ...
coderzzz18's user avatar
  • 2,625
112 votes
10 answers
236k views

useDispatch() Error: Could not find react-redux context value; please ensure the component is wrapped in a <Provider>

I am trygin to use React-Redux library and I am getting the error on the title. I wrapped my components with Provider but I still get the error, only if I implement the useDispatch() hook. The app ...
MIPB's user avatar
  • 2,291
88 votes
4 answers
58k views

Passing props to react-redux container component

I have a react-redux container component that is created within a React Native Navigator component. I want to be able to pass the navigator as a prop to this container component so that after a button ...
Mike's user avatar
  • 6,199
77 votes
5 answers
147k views

how to async/await redux-thunk actions?

action.js export function getLoginStatus() { return async(dispatch) => { let token = await getOAuthToken(); let success = await verifyToken(token); if (success == true) { ...
nabeel's user avatar
  • 1,191
49 votes
3 answers
67k views

Could not find "store" in either the context or props of "Connect(App)"

I'm having problems with misconfigured Redux after merging contents of multiple files into one to serve as config for Redux. How to resolve store, while keeping this in one file? Unhandled JS ...
Peter G.'s user avatar
  • 7,954
48 votes
12 answers
68k views

How to pass props to Screen component with a tab navigator?

This is my first post on StackOverflow, so apologies if I'm not following the correct format. I'm building my first app using tab navigator from React Navigation v 5.x and have run into a big problem ...
weedskurt's user avatar
  • 481
46 votes
4 answers
25k views

React Redux: Should reducers contain any logic

I have a cart reducer function with add, update and delete cases. I also have a product array within the redux store. When there are two items added to the product array, instead of having two items, ...
IVI's user avatar
  • 2,078
43 votes
2 answers
80k views

React-redux component does not rerender on store state change

I'm stating to learn react and redux today, yet I cannot figure out how to force component to rerender after state change. Here is my code: const store = createStore(loginReducer); export function ...
Momen Zalabany's user avatar
34 votes
11 answers
45k views

The react-scripts package provided by Create React App requires a dependency:

There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create React App ...
user avatar
34 votes
7 answers
47k views

Global state in React Native

I am developing a React Native application. I want to save the user id of the person who is logged in and then check if the user is logged in in every single component. So what I am looking for is ...
Jamgreen's user avatar
  • 10.9k
31 votes
13 answers
15k views

Unable to resolve module `./../../react-transform-hmr/lib/index.js`

error: bundling failed: Error: Unable to resolve module ./../../react-transform-hmr/lib/index.js from /ReactNative/UsermanagementNav/src/App.js: The module ./../../react-transform-hmr/lib/index.js ...
Divyang Solanki's user avatar
30 votes
2 answers
23k views

How do you mix componentDidMount() with react-redux connect()?

This seems like a simple use case but I can't figure it out. I want to display a list of items retrieved from a request to a remote API over HTTP. I would like the screen to show blank initially while ...
evilfred's user avatar
  • 2,396
27 votes
8 answers
48k views

"React.createContext is not a function" - but I am not using it

I am getting "React.createContext is not a function" error while running a react-native application. I searched for 'createContent' in the code, it doesn't exist. Any idea what may be the reason for ...
Yossi's user avatar
  • 5,907
27 votes
7 answers
15k views

React.default.memo is not a function (React-Native) wrapWithConnect

I get this the error _react.default.memo is not a function and wrapWithConnect. This is a react-native project and it worked fine before I used the connect function to connect my dispatch into ...
phaseTiny's user avatar
  • 385
23 votes
3 answers
67k views

How to close the modal in react native

I am newbie to react native developing. I want to close the modal component on pressing outside the modal in reactnative. Below is my code. state = { visibleModal : false, }; _hideModal(){ ...
HSBP's user avatar
  • 765
23 votes
1 answer
14k views

How do I persist state for android apps killed in the background in react-native

When an Android App is sent to the background, it can persist its instance state in case it gets killed due to low memory (see Activity:onSaveInstanceState() and the bundle argument for Activity:...
Valentin's user avatar
  • 2,076
21 votes
4 answers
18k views

TaskQueue: Error with task: undefined is not an object (evaluating '_this.view._component.measureInWindow') in react native

I am very new to react native, I am facing this issue with very simple demo app while handling screen navigation Getting this error message TaskQueue: Error with task: undefined is not an object (...
div patel's user avatar
  • 213
21 votes
6 answers
20k views

React native + redux-persist: how to ignore keys (blacklist)?

I'm storing my settings with redux-persist and would like to ignore some of them to have them reset on every restart, e.g. after a crashing. It's possible to add an array of reducer-names as ...
Mr. B.'s user avatar
  • 8,469
20 votes
3 answers
15k views

React native Redux - object is not a constructor (evaluating 'new ctor(props context)')

This is a very simple page that is trying to use Redux....see code below. However Im getting the error object is not a constructor (evaluating 'new ctor(props context)') import React, {Component} ...
james murphy's user avatar
  • 1,715
19 votes
7 answers
8k views

Two apps after react-native run-android

I'm making a react native app and earlier it was working fine but now when I run "react-native run-android", after the successful install and launch, I can see two apps in the simulator and both of ...
Mayank Baiswar's user avatar
19 votes
7 answers
16k views

What is a difference between action,reducer and store in redux?

I am new to react/redux. I am trying to figure out how all the pieces in redux interact. The one thing giving me trouble is understanding the relation between actions and reducers,store.
Dishant Chanchad's user avatar
19 votes
2 answers
13k views

Export REACT_EDITOR for VSCode

How do you complete the following PRO TIP from the Android emulator node using the Windows cmd line for VSCode? "When you see Red Box with stack trace, you can click any stack frame to jump to the ...
Carl's user avatar
  • 321
19 votes
1 answer
10k views

React Native fetch API cannot disable caching

I am building android app using react native expo integrated with redux. The API is called using fetch method, but always the cached result is displayed. The server did not receive the request second ...
Mirza's user avatar
  • 1,542
18 votes
5 answers
55k views

How do I open in-app browser window in React native?

I'm trying to open the browser window without leaving the app when I click a URL (for both iOS and Android). The behavior should be as follows (with airbnb app example): Clicks in "Terms and ...
Facundo Bazzana's user avatar
17 votes
8 answers
46k views

The development client (com.reactnative02) for this project is not installed. Please build and install the client on the device first

I am getting the above error when previewing the react app on an android studio simulator. Please help. Here is the error: "CommandError: The development client (com.reactnative02) for this ...
Junaid khan's user avatar
17 votes
2 answers
22k views

Avoid status bar overlap on all screens

I want all screens on my app to appear below the status bar on both iOS and Android, so I'd either have to add a StatusBar component or a paddingTop to all my screens. Is there a way to do this ...
Avery235's user avatar
  • 5,156
17 votes
2 answers
13k views

mapDispatchToProps: any point?

I was wondering if there was still a point using mapDispatchToProps today. I'm working on the redux documentation tutorials (to build a todo list) where VisibleTodoList is described as: import { ...
Thanh-Quy Nguyen's user avatar
17 votes
3 answers
2k views

Router state not being persisted in react-native with redux

I have the following redux configuration in react-native using react-native-router-flux and redux-persist. I want to retrieve the last current route on refresh, however the route stack is being ...
jsdario's user avatar
  • 6,745
16 votes
5 answers
28k views

React Redux use HOC with connected component

I am in the middle of my first React Native project. I would like to create a HOC that deals purely with syncing data from an api. This would then wrap all my other components. If I am correct my ...
mtwallet's user avatar
  • 5,050
16 votes
1 answer
6k views

Redux in React Native app is very slow with lots of data

I have a large array of JSON objects I’m storing in a single Redux variable (~8k items, each with object about 1kb each for a total of 8mb). This seems to make Redux calls slow even for the most ...
tassock's user avatar
  • 1,653
15 votes
4 answers
14k views

Possible to dispatch an action without connect?

export default class App extends Component { ... componentDidMount() { //registering event listener BackgroundGeolocation.on('location', this.onLocation, this.onError); } onLocation(...
Isaac's user avatar
  • 12.7k
14 votes
2 answers
15k views

How and where to save the whole redux store using AsyncStorage

I was wondering if I have to do something like this to save the whole store of my app using AsyncStorage in my react-native app and check if it exists when the app is starting. var store; ...
Luis Rizo's user avatar
  • 2,099
14 votes
4 answers
9k views

How to fix '_react["default"].memo is not a function. (In '_react["default"].memo(connectFunction)' error in React native?

I am trying to connect Redux mapStateToProps() and mapActionCreators() to Login Screen through Container and I am using React navigation. After build my app the following error message appears: ...
Ahmed Saeed's user avatar
14 votes
1 answer
4k views

React native redux and ListView

I have seen at least one similar question. However I am interested in what is the pattern for redux usage in a react native application having a ListView. Should the reducers create a new ListView....
Sathyakumar Seshachalam's user avatar
14 votes
4 answers
3k views

redux-observable you provided 'undefined' where a stream was expected

I'm using the fbsdk to get user details in an ajax request. So it makes sense to do this in a redux-observable epic. The way the fbsdk request goes, it doesn't have a .map() and .catch() it takes the ...
BeniaminoBaggins's user avatar
13 votes
6 answers
34k views

React-Native-Maps: How to animate to coordinate?

I am using the following code with no success: //Inside of NativeBase Container <MapView.Animated ref="map" style = {styles.map} showsUserLocation = {true}...
Diego Penteado's user avatar
13 votes
2 answers
30k views

How can I change the default port in react from 3000 to another port?

how to change react default port 3000 to others port ? By default, a ReactJS app runs on port 3000. An Express.js app also runs on the same port 3000. If you were to run the two apps simultaneously, ...
Masud Rana's user avatar
13 votes
2 answers
5k views

Order of component life cycle with react-redux connect and redux data

We all know that constructor -> componentWillMount -> componentDidMount is order of execution. Now when redux comes into play and trying to access redux properties in our component life cycle. ...
Gaudam Thiyagarajan's user avatar
13 votes
6 answers
789 views

componentWillReceiveProps method doesn't run anymore when using redux to call api

I'm going to call api using redux: I used axios,history,react-redux,react-router-native,react-router,,redux-promise-middleware,redux-thunk component to make api call using redux: I made Reducers ...
Hussein Ojaghi's user avatar
12 votes
2 answers
6k views

What are the advantages and disadvantages of mobx and Redux, particularly in a React-Native environment? [closed]

Lately I've been hearing everyone talking about mobx, I've used (am using) Redux in a production React Native application. I'm just looking to see if anyone has experience with both and can advise ...
R. Langford's user avatar
12 votes
1 answer
20k views

Expected the reducer to be a function

I create a new react-native project and write a redux demo.IOS Simulator show the error 'Expected the reducer to be a function'.I tried to solve the problem from the preview answers,but it doesn't ...
laker's user avatar
  • 143
12 votes
4 answers
6k views

Is it okay to connect a PureComponent?

I was wondering if this is okay: import React, { PureComponent } from "react"; import { Text, TouchableOpacity } from "react-native"; import { connect } from "react-redux"; import PropTypes from "...
J. Hesters's user avatar
  • 14.2k
12 votes
2 answers
2k views

Paginate date-specific results from an API with React and Redux

I want to show some news in my React app using Redux. The problem is that I want to show the news for individual dates and I want to paginate the news. In my API I print { pagination: { count:...
Jamgreen's user avatar
  • 10.9k
11 votes
6 answers
35k views

How to hide the header from Tab navigation (bottom-tabs) in react navigation 5.x?

i am trying to use createBottomTabNavigator function for create bottom navigation tab, i want to hide the header, bellow the screenshot: I have a BottomTabNavigator inside a stackNavigator bellow ...
ELBOUARI's user avatar
  • 111
11 votes
3 answers
30k views

npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1

When I place the command npm update for an existing React project, this is displayed: npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated ...
zouhair zouita's user avatar
11 votes
1 answer
5k views

React Hooks Vs React-redux

After introducing hooks to Reactjs, Are they a good replacement for global store management like Redux or not? It's about their performance to react. I have used Redux and redux-saga in my recent ...
Ahmad Khani's user avatar
11 votes
4 answers
17k views

How to navigate screen on notification open in React Native with One Signal?

Here is my code, how can I navigate user to the desired screen when clicked on a notification or button in a notification. componentWillMount() { OneSignal.addEventListener('received', this....
Abid R.'s user avatar
  • 117
11 votes
3 answers
5k views

Redux with React-Native and mapStateToProps

I've read this thread. What is the difference between state and props in React? It says that props are different from states and ideally props should not be change in its component and only should be ...
gpminsuk's user avatar
  • 115
11 votes
3 answers
15k views

Getters in Redux's actions - React Native

I would like to have functions that can get the current state to do some logic with it, without having to pass the current state via parameters to the function. Here is my example. In my action file,...
Leon's user avatar
  • 542
11 votes
8 answers
17k views

Unable to reach expo servers

Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
user19500956's user avatar

1
2 3 4 5
76