Amiramix Amiramix - 1 month ago 5x
React JSX Question

Is paramemterless connect valid?

I sometimes see the following in our code:

@connect(() => ({}))
export default class SomeClass extends Componet {

I would understand if
was taking any arguments, e.g.
, but does it have any purpose when it's parameter-less?


It Injects to component just dispatch function. You can access dispatch in component through this.props.dispatch.

Api docs‌​les

if you don't map any slice of state to props, you should use connect(), otherwise it doesnt make any sense. Connected component will be notified , and it will invoke checking shalow equality of new stateProps and previous stateProps.