useList
Hook function for efficient rendering of list store. Every item will be memoized and updated only when their data changes.
Arguments
store
(Store): Store with array of itemsfn
(Function): Render function which will be called for every item in list
Returns
(React.Node)
Used when you need to pass dependencies to react (to update items when some of its dependencies are changed).
By default, useList
rerenders only when some of its items were changed.
However, sometimes we need to update items when some external value (e.g. props field or state of another store) changes.
In such case, we need to tell react about our dependencies and pass keys explicitly.
Arguments
store
(Store): Store with array of itemskeys
(Array): Array of dependencies, which will be passed to react byuseList
fn
(Function): Render function which will be called for every item in listgetKey
((value) => React.Key): Optional function to compute key for every item of list
::note
getKey
option introduced in effector-react@21.3.0
::