Questions tagged [redux]

Redux is a predictable state container for JavaScript applications based on the Flux design pattern.

0
votes
0answers
12 views

Testing Redux-connected React Component

My tests work, but I just know I'm not doing it correctly. My major concerns: I needed to add the same properties to the mockStore and ...
0
votes
1answer
26 views

Suppress API call in Redux Saga based on a timer

I have an API that provides data that is updated on an infrequent schedule, about once every 2½ minutes on average. Assuming that it's okay to fetch only as often as every 2½ minutes or less often, I'...
1
vote
0answers
19 views

Dynamically build tagged union and helper that allows its instantiation and calling of its static methods

I am working on a typescript react/redux app that provides a visual interface for the code editor with a predefined set of instructions. It's basically a tree structure of objects that I call ...
1
vote
0answers
321 views

React Hooks conditional in useEffect

I'm starting using hooks, and I have a specific scenario that I'm thinking useEffectis appropriate for. Essentially what I'm doing is: I have some ...
4
votes
2answers
100 views

Best way to retrieve music metadata from audio files?

I am using the music metadata-browser npm package to retrieve audio metadata from files. This library is being used in an Electron and React desktop app. To get the metadata of audio files, (and add ...
0
votes
1answer
29 views

Optimizing NGRX reducer

I am trying to optimize my reducer code, preferably into one-liner with high-order-functions. Reducer should return new array with names of groups, with new number. Below are correct inputs and ...
0
votes
1answer
41 views

Returning a new object reference when mutation happens

i attempted to create a way (not sure if already implemented by someone) by which when i update a property of an object. it returns a new reference of the object with the new value. i have a usecase ...
1
vote
1answer
52 views

Redux: button click potentially fires 3 action for different reducers

I’m using Redux and thunk, I have a list component ...
1
vote
1answer
24 views

Summary page with react-redux: container or presentational component

I'm building a Summary page for merchant activity in a marketplace with react and redux. The application has already a structure where there is a "MerchantContianer" ...
0
votes
0answers
34 views

A better way to retrieve data in firebase using redux

So i want to be able to make the following method inside of componentWillMount more robust, and essentially put this method inside an actions function. Post.js <...
1
vote
0answers
26 views

In React/Redux, fetch a list from a server and create a randomized subset with lifecycle methods

This is my first React/Redux project. I'm pulling down a list of Google Fonts, then displaying a list of 3 randomly selected ones. I want the list of random fonts to be populated automatically after ...
0
votes
0answers
29 views

Fibonacci-Counter implemented with React-Redux

After learning the basics of React-Redux I've made an app to familiarize myself more with the concepts. It's a counter which counts-up the Fibonacci-Number. Here's my code: ...
2
votes
1answer
38 views

Redux actions inside a container for a calculator

I used to import all the actions in the container's argument which looks messy (I put a comment below where I do it in that way). I want to know if there is a better approach when using actions with ...
0
votes
1answer
446 views

Playing cards with ReactJS

I came across problem 54 on projecteuler.net and decided to give it a go using ReactJS. I have had Angular experience prior to this. I wrote a couple of fully tested components. I think that they only ...
1
vote
0answers
13 views

Dispatches an event to detect a camera - Once the camera has initialised resolve a promise to say the camera is detected

I am relatively new to redux - I wanted to keep the actions in the same detectJsCamera function which is why I decided to resolve a promise to detectCamera - hence the set timeout. I am not sure how ...
2
votes
0answers
35 views

Status dispatching of my redux-thunk async action (post request)

I'm trying to dispatch to my reducers the current status of my request. So far I'm wondering how refined the status publishing of my thunk action. I feel like my code is very verbose and I wonder ...
4
votes
2answers
304 views

Flux architecture implementation (vanilla JS)

I'm trying to better understand flux-style architecture, so I wrote this snippet to clarify how a simple flux system can be designed. I was wondering if my implementation is valid, or if I've missed ...
2
votes
2answers
170 views

Redux Recipe List

I made a simple React + Redux app which allows you to add and remove recipes to a list. Here are the user stories the app fulfills: User Story: I can create recipes that have names and ingredients....
1
vote
0answers
266 views

Simple blog using react redux react-router

I've implemented the logic of my app, but I'm not sure whether it appropriate way or not. Task: create a react app using redux, react-router v4 which has a page with a form for adding new post and ...
0
votes
1answer
303 views

TODO in React w/ Redux

Please critique my TODO App in React w/ Redux: ...
3
votes
1answer
288 views

Angular + Redux app organization and initialization: transfer from a PHP-driven website

Our system is largely a PHP-driven system. We're not doing the full split back/front-end. Most pages are plain HTML served directly by PHP. However, a few parts of the system are very dynamic and ...
1
vote
0answers
112 views

React Redux default playground

Lately I am answering more and more questions regarding ReactJS & Redux on SO and I created a basic playground that should help me answer questions faster. The goal of the playground is to have ...
1
vote
1answer
53 views

DRYing out my action creators

I've created a private function called _successResponse to handle successful responses from my promise. The challenge was passing the dispatch function to the <...
1
vote
1answer
37 views

Logging observable values while extending service

I'm trying to extend a service function which returns an Observable<T>. The idea is to extend the function so I can add logging functionality whenever the ...
3
votes
1answer
63 views

Photo rating function

I want to create a photo rating function. If I click thumbs up then votes increase, and if I click thumbs down then votes decrease. ...
1
vote
0answers
147 views

Asynchronous counter

I built a simple counter in React. I'm using Redux for state management and Redux-Saga for async calls. I'm looking for feedback on directory structure, coding style and pretty much everything else. ...
1
vote
0answers
517 views

React, Redux and SignalR connection dependent on global jQuery

I'm writing a react/redux application and I'm on a stage when I need to connect it with backend made with .net using a signalR socket connection. At the moment I've established interconnection ...
2
votes
0answers
265 views

A CRUD blog with a basic auth system made with the MERN stack

I would like some feedback on things that maybe could've been written a lot better. I used redux for handling state. GitHub repo Demo This blog project is meant to create, read, update, and delete ...
2
votes
3answers
272 views

Next and Previous navigation

I'm sorry, maybe this question is really stupid but I have really been thinking a lot about it recently, thinking of which type of <prev | next> web ...
1
vote
0answers
37 views

Rendering two logos in a React search component

Using React.Perf I found that there are few bottlenecks in the render code of one component from the big React app (look at the numbers 1 and 2 in the code below). For sake of simplicity I stripped ...
4
votes
0answers
149 views

React.js defaultMemoize as container

this is the code I wrote ...
3
votes
2answers
188 views

Rewriting Crime Map - React Component with Redux

I've been working on a crime map demo - and I am keen to learn more about how to rewrite this application to use redux. What is the best approach, why - what is wrong with the way its currently ...
2
votes
0answers
104 views

Update state to render data in a form

I have a form which needs to display value in its input field initially. There is no post API used, only get and put. I could show the data initially by updating the state from the ...
4
votes
1answer
1k views

Generic dataloader for redux-thunk using axios

I am developing an application where there are lots of async actions. I wanted to go with redux-saga but most have insisted to continue with redux-thunk. In redux-thunk, inside each action we have to ...
1
vote
0answers
510 views

An Mp3 player using React and Redux and the HTML5 web audio API

I built a simple MP3 player with React and now I would like to incorporate Redux to the app as it is getting larger and I feel Redux will help it to be more organized and efficient. I was wondering ...
2
votes
0answers
42 views

Create exact replica of react component with different name

I have a react native component called "width". It has 3 width values which have associated <TextInput>s which map to the redux store as ...
3
votes
0answers
351 views

React component with conditional form loading

I'm remaking an existing application into a single page application. I've created this component to take the place of multiple pages in the previous version. It shows a form with disabled data about ...
4
votes
1answer
5k views

Redux reducer with a filter

I'm wondering if my approach to creating a filtered array (filteredLaunches) from an array of data (launches) is an anti-pattern, or not? Is there a better way to go about it? Here is the code: <...
2
votes
0answers
12k views

Reset an input field after submission

i have some issues dealing with a simple case in my redux-react app: i want to reset an input text after an asynchronous operation ignited by a button. Let’s say we have an input text in which you ...
3
votes
0answers
100 views

Filtering search results for apartment and car rentals

I am developing an app which is somewhat similar to airbnb. There are two search function, one for searching apartment and other for searching car rental. When searching apartment, the result page ...
2
votes
0answers
49 views

Lcation of redux “random” state initialization

I'm creating 2048 to practice React/Redux. I've got a game board that appropriately shifts, and follows the game rules (it works). I'm more concerned with my understanding of handling Redux reducers (...
1
vote
0answers
1k views

React Redux quiz app

I started learning about React and redux recently and I created a dummy project based on drf-redux project and react-redux-quiz-game This application uses Django rest framework for API and React with ...
1
vote
0answers
62 views

App for adopting pets

I am building a small app for adopting different types of pets. My API looks like this: ...
2
votes
0answers
4k views

Simple list table with pagination in ReactJS

I recently got rejected from interview after I send them this site. They said it is too contrived, and I used Redux which was unnecessary. I really would like to know what is it specifically. I tried ...
2
votes
0answers
117 views

Show dialog to add device and tab

I am just into redux. I am developing a dashboard using ReactJS redux and material-ui for components. It's a large app as my dashboard contains various features like add/edit/delete device, add/edit/...
2
votes
0answers
681 views

React/Redux 401 Middleware

I'm trying to create an API middleware which will react to every 401 response from the API. I've tried to search for possible solutions, but I'm kinda lost here. I have created a special 401 response ...
2
votes
0answers
471 views

Bind component state to redux store state

I've recently started working on some projects with react & redux. I understand it is best practice to manage component/UI state inside a component with ...
3
votes
2answers
4k views

Implementing redirect in Redux middleware

Let's say I have following action: export function signIn(data) { return { type: USER_SIGN_IN, promise: api.post('/sign_in', data) } } and the ...
1
vote
1answer
3k views

Counter with increment and decrement buttons

For my first Kotlin project, I'm implementing the Redux pattern with simple Increment and Decrement buttons and a text view to display the current value. My main questions have to do with Kotlin and ...
2
votes
0answers
2k views

CRUD application using React-Redux

I am working on a React-Redux app, which is a CRUD application for a school. The first part was to implement adding/removal of classes (aliased to standard). However, the code seems unreasonably bulky ...