effector / effector/effector

Merge `values` and `handlers` in `fork`

Open
#1,068 0 comments 2 reactions 0 assignees View on GitHub
discussion fork api RFC
Dominant language
TypeScript
Stars
4.9k
Forks
280
Avg merge
2d 6h
Merged PRs (30d)
7

Description

## Proposal

Merge `values` and `handlers` in `fork` to single property. Effector can choose between store and effect automatically, so possibly we can merge them to single property.

```ts
fork({
fill: [
[$foo, 'foo'],
[$bar, 1],
[requestFx, () => null],
[getUsersFx, () => []]
]
})
```

**Pros**: easier to use, like useStore and useEvent was merged to useUnit
**Cons**: another breaking change, benefits of merge not obvious, as many people still write useUnit(stores) and useUnit(eventsOrEffect) in two calls to preserve semantic distinction

Not sure which property name could be used and whether we need to go in this direction so I create this issue to remember that we have this option

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.