XaveScor/signal-components

ctx.component map callback

XaveScor opened this issue · 0 comments

It looks like we can add a mapper callback to the ctx.component:

const Component = declareComponent<{p: number}>(({p}) => {
  return ({ctx}) => ctx.component(p, x => x + 1);
});

The main trouble is that we use the stable prop invariant. It allows us to save the link Map<Atom, React.ReactElement>. The primary usage is creating a mapper in the render phase. It is a little bad for performance because we will get a new mapper function every render. So, we cannot wire Map<Atom + mapper, React.Element>.