Skip to content

Instead of providing HOCs, provide container components #5

Closed
@hugooliveirad

Description

@hugooliveirad

As in the docs, the decorator @observes could couple the counter with the counterStore, instead of giving it the freedom from receiving the counter from any data source via props.

I like flummox's FluxComponent way of doing stuff: your component is pure and a top-level component chooses how to feed it.

import { Observes } from 'redux/components';

<Observes store="counterStore">
  <Counter /* counter={counterStore.counter} */ />
</Observes>

For the @performs decorator we could have an equivalent component that wires an event of a component (e.g. onClick, onIncrement) with an action.

import { Performs } from 'redux/components';
import increment from './actions/CounterActions.js';

<Performs actions={{'onClick': increment}}>
  <IncrementButton />
</Performs>

I think we have much more power using components this way. More testable and reusable.

I'm far from being an expert on decorators and even on Flux, so please show your views and let's discuss this thread 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions