Attach/detach many-to-many

Attach and detach entities of a many-to-many relationship

Action: attach

Example:

actionCreators.attach('item', 'i1', 'tagIds', 't1')

Action: detach

Example:

actionCreators.detach('item', 'i1', 'tagIds', 't1')

Demo:

Click on a box. Then click the checkboxes in the opposite column to attach/detach it. Attaching and detaching will change both entities in state.entities.

i1

Item 1

Attached Ids:
["t2","t3"]
i2

Item 2

Attached Ids:
[]
i3

Item 3

Attached Ids:
[]
t1

Tag 1

Attached Ids:
[]
t2

Tag 2

Attached Ids:
["i1"]
t3

Tag 3

Attached Ids:
["i1"]