All Questions
Tagged with react-native redux
3,715
questions
255
votes
4
answers
450k
views
Axios get in url works but with second parameter as object it doesn't
I'm trying to send GET request as second parameter but it doesn't work while it does as url.
This works, $_GET['naam'] returns test:
export function saveScore(naam, score) {
return function (...
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 ...
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 ...
96
votes
4
answers
118k
views
Subscribe to single property change in store in Redux
In Redux I can easily subscribe to store changes with
store.subscribe(() => my handler goes here)
But what if my store is full of different objects and in a particular place in my app I want to ...
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 ...
73
votes
5
answers
44k
views
Nested redux reducers
Is it possible to combine reducers that are nested with the following structure:
import 'user' from ...
import 'organisation' from ...
import 'auth' from ...
// ...
export default combineReducers({
...
61
votes
4
answers
41k
views
How to use Redux to refresh JWT token?
Our React Native Redux app uses JWT tokens for authentication. There are many actions that require such tokens and a lot of them are dispatched simultaneously e.g. when app loads.
E.g.
...
60
votes
6
answers
88k
views
Wipe AsyncStorage in react native
I notice that I am wasting a certain amount of time debugging redux actions that I am persisting to AsyncStorage in react-native thanks to redux-persist. Sometimes I'd just like to wipe AsyncStorage ...
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 ...
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, ...
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 ...
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 ...
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 ...
30
votes
4
answers
19k
views
Proper way to navigate with React Native, Redux, and Navigator
I have a React Native app using the Redux framework and I'm using the Navigator component to handle navigation. I've had a little bit of trouble getting the navigation working and I'm not able to find ...
29
votes
3
answers
8k
views
Architecture in a react native app using WebSockets
I have a React Native app I'm going to be building that uses WebSockets. I have a WebSocket library written in JavaScript and I'm simply re-using it for this project, which is fantastic.
My question ...
29
votes
1
answer
8k
views
Using Realm in React Native app with Redux
I am about to undertake the development of a React Native app and am thoroughly convinced of the benefits of managing the app's state using Redux, however I'd like to make the app's data available ...
28
votes
3
answers
27k
views
React Redux - Is adding async method in a Reducer an anti pattern?
I'm pretty new to the whole react-native / redux world, so maybe this question will sound dumb :)
I know that for an API call, or stuff like that, the convention is to use middleware, but is it ...
28
votes
1
answer
11k
views
Relay vs Redux vs Apollo with GraphQL and React-Native [closed]
I have to start a new (web + native) project (mid-size app) from scratch. Due to the plethora of JS frameworks and implementation out there especially in the last couple of years, I have been having a ...
27
votes
5
answers
84k
views
How to slide <View/> in and out from the bottom in React Native?
In React Native iOS, I would like to slide in and out of a like in the following picture.
In the following example, when a button is pressed, the Payment Information view pops up from the bottom, ...
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 ...
26
votes
3
answers
19k
views
React Native + Redux basic authentication
I'm looking for a way to create a basic authentication for my react-native app.
I couldn't find any good example for react-native app.
To login, the app sends the email/password + clientSecret to my ...
22
votes
1
answer
4k
views
State Management for Animations Using React Native and Redux
Background
I've been building an application using React Native & Redux to make an assessment over whether to use it for an upcoming project over Swift and going fully native.
I genuinely believe ...
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 ...
20
votes
2
answers
11k
views
React Native: Animation when component unmounts
I have a custom modal which slides in upon componentDidMount:
componentDidMount() {
Animated.timing(this._animatedValue.y, {
duration: 200,
toValue: 0
}).start()
}
Ok, ...
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.
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 ...
19
votes
4
answers
14k
views
What are options to debug a React Native + Redux app?
I have been researching options to debug a React Native + Redux app. Especially the redux part. What is your preferred way to do this? Hope to know!
18
votes
9
answers
31k
views
React Native - React Navigation slow transitions when nesting navigators
I am building a cross-platform native application using react-native and using react-navigation for navigating to and from screens and managing navigation state using redux. The problem arises when I ...
18
votes
5
answers
11k
views
How to make React Native mobile application faster?
React Native mobile application is working very slow on every click.
I am using react native v0.40.0 and following are the dependencies of my project.
{
"analytics-react-native": "^1.1.0",
"...
18
votes
4
answers
21k
views
How to use react j s components in react native app?
Is it possible to use all the reactjs components in react native app?If no,what is the best way to switch between react js and react native?
If an app is done using react js is it necessary(...
17
votes
6
answers
18k
views
ScrollView minHeight to take up all the space
I have a ScrollView which content doesn't necessarily exceeds it's size. Let's say it's a form where, upon errors, it expands to add error messages and then it exceeds the ScrollView size and thus is ...
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 ...
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 { ...
17
votes
3
answers
29k
views
How to Cache API data using AsyncStorage React Native
Fairly new to React native and its concepts. I have been playing with RN for a while to create an application to fetch API data from
http://jsonplaceholder.typicode.com/photos
I have been looking ...
17
votes
2
answers
8k
views
default values from initial state are loaded before store rehydrates with redux-persist
I'm having trouble accessing saved data after app starts with redux-persist.
The reducer initializes with data defined in my initial state. By the time the previous session's state loads with ...
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 ...
16
votes
5
answers
33k
views
React-native android back button in react-navigation
Well, I have a react-native app with multiple screen, each screen having a top bar where a back button is situated, it's main behavior is that the app returns to the main screen when this button is ...
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 ...
16
votes
2
answers
3k
views
Load redux store initial state in Detox Testing
Problem
We have a quite complex application and we don't want in each test case to go through the whole process to get to specific screen to test it, alternatively we just want to jump to specific one ...
16
votes
3
answers
9k
views
Where to put API calls in React/Redux architecture?
I am trying to retrieve some data from an API and pass it into my application. Being new to React/Redux however, I am wondering where to make these calls from and how to pass it into my application? I ...
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 ...
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(...
15
votes
4
answers
16k
views
withNavigation can only be used on a view hierarchy of a navigator
I'm getting the error:
Invariant Violation: withNavigation can only be used on a view
hierarchy of a navigator. The wrapped component is unable to get
access to navigation from props or context
...
15
votes
2
answers
24k
views
How to pass parameters with redux-saga
as an exercise for react-native & redux-saga, I am trying to develop a little Weather-Application.
While fetching and presenting the data works just fine, I somehow struggle to pass a parameter ...
15
votes
1
answer
1k
views
Synthetic scene stack (history) with React Native Router Flux
Is there any way how to synthetically define scene stack (history) with React Native Router Flux? Let's say I have an app, where the user can naturally navigate from A –> B –> C. I'd like to ...
14
votes
3
answers
20k
views
redux-saga: How to create multiple calls/side-effects programmatically for yield?
With redux-saga, one can execute multiple effects in parallel:
import { call } from 'redux-saga/effects'
// correct, effects will get executed in parallel
const [users, repos] = yield [
call(...
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;
...
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:
...
14
votes
1
answer
17k
views
How can I use redux persist for only one reducer not for navigation reducer in my react native application?
I am using Redux persist to persist my store for reducers. My application has two reducers Navigation and User Reducer.I want to persist only user state but I have to persist both states according to ...
14
votes
2
answers
5k
views
React-Navigation: Use/Change header title with Redux state
Is it possible to access the whole Redux state inside the React Navigation's header title?
The official docs says that the state corresponding to the navigation is accessible:
static ...