reflux / refluxjs

A simple library for uni-directional dataflow application architecture with React extensions inspired by Flux
BSD 3-Clause "New" or "Revised" License
5.36k stars 330 forks source link

Update README.md #489

Closed timoj closed 7 years ago

timoj commented 7 years ago

Added extra examples for ES6 notation

BryanGrezeszak commented 7 years ago

I'm confused about your statements about not being able to assign actions to a variable in ES6.

I wrote 2 files just today where I did just that: assigned the actions to a variable while exporting them as a module. Also, the example you gave wasn't ES6, it was CommonJS. It seems like you're documenting some quirk you didn't expect from CommonJS as if it's something specific to Reflux.

Here's a file I wrote just today that is ES6 and assigns the actions to a variable while exporting:

export var DragActions = Reflux.createActions([
    'beginDrag',
    'enterDropSpot',
    'leaveDropSpot',
    'droppedOnDropSpot',
    'droppedOffDropSpot',
])

As for the example of multiple stores, the docs do already state what you state, though they don't give an example. So there's nothing wrong with adding an example. But personally I think we can lose the explanation of the fact that you create Arrays via square brackets instead of curly. That's below the scope of these docs.