Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow useStoreMap for shapes #864

Open
xaota opened this issue Mar 2, 2023 · 1 comment
Open

allow useStoreMap for shapes #864

xaota opened this issue Mar 2, 2023 · 1 comment
Labels
RFC Request for Comments

Comments

@xaota
Copy link
Contributor

xaota commented Mar 2, 2023

Proposal

const value = useStoreMap({
  shape: { a: $a, b: $b, c: $c }, // ! now param name is "store", proposal - rename to "shape" or "units"
  keys,
  fn
});
  • maybe rename this method to useShapeMap or useUnitMap оr useUnitMemo ?

Use case

now, we need a combined store for this cases:
// model.ts

import { combine } from "effector";

export const $combined = combine({ a: $a, b: $b, c: $c })

// Component.tsx

import {$combined} from "./model.ts";

...
const value = useStoreMap({
  store: $combined,
  keys,
  fn
});
@xaota xaota added the RFC Request for Comments label Mar 2, 2023
@sergeysova
Copy link
Collaborator

I suppose we don't need to rename the whole hook:

const value = useStoreMap({
  source: { a: $a, b: $b, c: $c }, // Just rename the parameter. Or don't rename anything
  keys,
  fn
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for Comments
Projects
None yet
Development

No branches or pull requests

2 participants