faceyspacey.com
faceyspacey.com

Reputation: 2630

In Redux are there performance implications to always passing all actions?

for example like this:

import * as actions from '../actions';
@connect(null, actions);
export default class MyClass extends React.Component {

From a performance perspective, is it worth it to specify which actions a component uses?

Upvotes: 0

Views: 44

Answers (1)

Shane Cavaliere
Shane Cavaliere

Reputation: 2223

It probably won't be a significant performance issue. There are most likely tons of other optimizations you can make (e.g. network related or managing re-renders) that will be much more effective than JS micro-optimizations like this.

That said, I always prefer to be explicit with imports and passing actions. I think it helps you consider exactly what a component's responsibilities are, which helps you keep your app well organized. I also think it makes the code more readable.

Upvotes: 1

Related Questions