jamesplease / jamesplease/react-resources
useMemo in useResources
- 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