jamesplease / jamesplease/react-resources

useMemo in useResources

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

For performance:

```js
import _ from 'lodash';
import ContextWrapper from './resource-context';
import { useContext } from 'react';

export default function useResources(resourceType, filter) {
const store = useContext(ContextWrapper.Context);

// Memoize this
return _.chain(store)
.get(`state.resources.${resourceType}`)
.filter(v => filter(v))
.value();
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the useResources hook shown in the issue and inspect how its store and filter inputs change between renders. Done means the returned filtered resources keep their current behavior while the computation is memoized for unchanged inputs; validate this with the repository's existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, performance
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.