Skip to main content
6 votes
Accepted

TODO in React w/ Redux

I'm not exactly sure of your environment (I'm going to assume you're using Node), and with this assumption, I want to address a few things starting with specific things, then more general: Specific ...
Andrew Li's user avatar
  • 271
6 votes
Accepted

Managing redux state of mutiple switch components

The general idea here is that we have seven different toggles and we don't want to write the same code seven times in every place. We want to define functions that act on a general notification and ...
Linda Paiste's user avatar
5 votes
Accepted

Best way to retrieve music metadata from audio files?

It appears music-metadata is the Node.js/desktop flavor of music-metadata-browser (intended for browsers). The author doesn't explain the differences between the two, but maybe the desktop variant ...
Oh My Goodness's user avatar
5 votes

Calling functions if certain strings are in an array

The first thing I would extract is the condition: ...
alexfertel's user avatar
4 votes

Best way to retrieve music metadata from audio files?

Caching and Streaming. Cache data I can not work out if you are doing this each time your app loads. If you are and it is a slow point you should consider storing the processed data in a file or ...
Blindman67's user avatar
  • 22.9k
4 votes
Accepted

Calling functions if certain strings are in an array

Define types If you are using a typed language like TypeScript, you should use it correctly. Defining most of the variables as type any does not give you robust ...
Blindman67's user avatar
  • 22.9k
3 votes
Accepted

React Redux mutating implementation

Mutation is generally discouraged in Redux (and React in general) because it breaks tooling/libraries that expect x === y to mean that ...
Nathan's user avatar
  • 121
3 votes

Best way to retrieve music metadata from audio files?

The reason that code becomes slow, is because this code parses all files in parallel. This causes an exponentiation growth of open files, memory allocation, and becomes an impossible task to complete, ...
Borewit's user avatar
  • 221
3 votes
Accepted

Flux architecture implementation (vanilla JS)

First of all, Flux is not to be confused with Redux. While both have similarities, the main difference is that Flux allows multiple stores while Redux advises only using one store per app for ...
Joseph's user avatar
  • 25.4k
3 votes
Accepted

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

I'm especially interested in any feedback on my initialization procedures: ... Is that reasonable? As long as your code is dealing with configuration only, it looks good to me overall. (I assume, you ...
Igor Soloydenko's user avatar
2 votes
Accepted

Logging observable values while extending service

One way to achieve what you want is to use .do() and may be .catch() operators. .do() ...
Igor Soloydenko's user avatar
2 votes

Photo rating function

There's a few things you can do and different approaches depending on your personal preference. You could: Extract the cases to pure functions Extracting the logic to methods could help with ...
Craig Ayre's user avatar
2 votes

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

You can turn the action types to constants. Have action creators https://redux.js.org/recipes/reducing-boilerplate/ In deletePosts you're passing a cb that's never ...
MonteCristo's user avatar
2 votes

Next and Previous navigation

About the HTML As pagination is some form of navigation (i.e., links), you should use a elements instead of button elements. ...
unor's user avatar
  • 2,673
2 votes

Next and Previous navigation

I agree with James that #3 is better because of the separation aspect. I admit that I am a novice as far as React goes, having typically worked with other frameworks like jQuery, PrototypeJS, ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes
Accepted

Next and Previous navigation

Think your worrying yourself about small details here, any advantages of one over the other would be minor at best. I think out of all 3, the last solution would be my preferred one. It's clean from ...
James's user avatar
  • 567
2 votes

Redux Recipe List

I've only started working with React/Redux myself, but here are my thoughts. In my system I am saving the form values to local component state until the form is saved. I have one onChange handler ...
David C's user avatar
  • 121
2 votes
Accepted

Redux: button click potentially fires 3 action for different reducers

I was wondering if when the user clicks “Save” it is better to call a function in the List component that calls “addNew” and “deleteB” and finally “editSave” to only update the state for the “editing” ...
Joseph's user avatar
  • 25.4k
2 votes

Flux architecture implementation (vanilla JS)

Object.assign({}, model) is not deepcopy, it is shalow copy only, you should consider to use Immutablejs by Facebook or write your own library. ...
NTCG's user avatar
  • 21
2 votes

Suppress API call in Redux Saga based on a timer

Disclaimer: I´m not an expert in redux / redux-saga. This post is not directly answering your questions. Rather, it is focused on code design / architecture and what is the most useful approach for ...
Alex Lawrence's user avatar
2 votes

Redux/Redux-saga forms architecture optimisations

The reason why you have to search in the way you currently are is because your redux store is so deeply nested. Flatten it and it will make things a lot easier. Have all text inputs, regardless of ...
Andrew's user avatar
  • 359
2 votes

Simpler state manament alternative to Redux, MobX, Context API, etc

After looking at the implementation, this is not an implementation of global state management. The entire point of things like redux is so you can directly connect components to a global store. In ...
Andrew's user avatar
  • 359
2 votes

React continuous polling

There are many ways you could implement polling but this one is valid enough for a lot of cases. You could hide your timer off in a redux action somewhere if you were so inclined. It's worth ...
rockingskier's user avatar
2 votes

join method inside axios call

Using Array.join is unrelated to usage of async and await. Also note that the time it takes ...
Mohrn's user avatar
  • 400
2 votes

React custom hook

It's a good idea to abstract this away. Otherwise you would end up with a lot of different callbacks. But I think your approach might be improved. First: why do you use different actions instead of ...
jkettmann's user avatar
  • 156
2 votes
Accepted

React custom hook

I agree with the other answer from @jkettmann that you should abstract this. Generally speaking having a long list of if-else conditions usually has a better alternative. That could be a reducer like ...
Quill's user avatar
  • 12.1k
2 votes

interest calculator with React+Redux

Everything's on the front-end You're using HTM to interpret the JSX by putting the JSX through a template literal. It's quite an interesting option, but for a professional project, I think compiling ...
CertainPerformance's user avatar
2 votes

Redux Toolkit Structure with TS

I am blown away by how much less code I need to write I'm going to blow your mind even more because you actually do not need to dispatch any actions inside ...
Linda Paiste's user avatar
2 votes
Accepted

Using Redux state in React component

Performance I don't think that you need to change the approach you are taking with isSmall, it is very cheap to create that variable each render. The other two ...
alexfertel's user avatar
2 votes
Accepted

Proper way of using redux and props

Redux has a really great style guide which outlines all of the best practices. I can use that to show which rules you are breaking to give you more specific feedback. The good news is that you are ...
Linda Paiste's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible