<commit_before># React bindings
> `selectorMemoizer(selectors, projectionFunction)`

This function takes an object, `selectors`, containing the functions necessary to retrieve the relevant data form the `store` and a `projectionFunction` to calculate the results from the inputs. The result is memoized so that if the component is re-rendered but the inputs haven't changed the last known results are returned and the `projectionFunction` isn't invoked.

## Example usage
You may have a selector that maps the raw JSON response from an API call to something more usable like a map of ID's to resources. You really don't want to perform this operation every time the component is re-rendered as that would kill performance and create a lot of garbage on the memory. Memoizing this operation is the way to go.

```js
import { selectorMemoizer } from 'preact-reduxless'

export const resources = selectorMemoizer(
  {
    projects: store => store.get('resources')
  },
  ({ resources = [] }) => new Map(resources.map(r => [r.id, mapProject(r)]))
);
```

## A more complicated example using multiple selectors
```js
export const resourceIds = selectorMemoizer(
  {
    resources: store.get('resources'),
    selectedIds: store.get('selectedIds')
  },
  ({ resources, selectedIds }) => {
    const selected = new Set(selectedIds);
    const list = Array.from(resources.values()).filter(({ id }) => selected.has(id);
    return list.sort().map(r => r.id);
  }
);
```
<commit_msg>updated docs for new usage of selectorMemoizer<commit_after># React bindings

> `selectorMemoizer(projectionFunction, selectors)`

The first argument of `selectorMemoizer` is a `projectionFunction` which is given inputs from the selectors. The selectors retrieve the relevant data form the `store`. The result is memoized so that if the component is re-rendered but the inputs haven't changed the last known results are returned and the `projectionFunction` isn't invoked.

## Example usage

You may have a selector that maps the raw JSON response from an API call to something more usable like a map of ID's to resources. You really don't want to perform this operation every time the component is re-rendered as that would kill performance and create a lot of garbage on the memory. Memoizing this operation is the way to go.

```js
import { selectorMemoizer } from 'preact-reduxless'

export const resources = selectorMemoizer(
  ({ resources = [] }) => new Map(resources.map(r => [r.id, mapProject(r)])),
  projects: store => store.get('resources')
);
```

## A more complicated example using multiple selectors

```js
export const resourceIds = selectorMemoizer(
  ({ resources, selectedIds }) => {
    const selected = new Set(selectedIds);
    const list = Array.from(resources.values()).filter(({ id }) => selected.has(id);
    return list.sort().map(r => r.id);
  },
  resources: store.get('resources'),
  selectedIds: store.get('selectedIds')
);
```

{'fraction_non_alphanumeric': 0.10126150698943062, 'fraction_numerical': 0.0, 'mean_word_length': 4.63147792706334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6397209', 'n_tokens_mistral': 797, 'n_tokens_neox': 771, 'n_words': 344}