Kea 2.3: Bind Logic
Marius Andra
Kea Core TeamTL;DR
New tag: <BindLogic logic={itemLogic} props={{ id: 12 }}>
.
It lets you write useValues(itemLogic)
instead
of useValues(itemLogic({ id: 12 }))
in nested children. Powered by React Context.
When using keyed logics it's easy to get into a situation where you need to pass props similar to this:
In Kea 2.3 you can use <BindLogic>
to clear this up:
When you write <BindLogic logic={itemLogic} props={{ id: 12 }}>
, Kea stores a specific build of
itemLogic
inside a React Context. Any nested children will get that when calling e.g: useValues(itemLogic)
.