ipetinate / ipetinate/localstorage-helper

Criar React Hooks para obter dados de uma determinada Key

Open
#5 0 comments 0 reactions 0 assignees View on GitHub
documentation enhancement good first issue help wanted
Dominant language
TypeScript
Stars
7
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Criar um hook customizado do react para obter a Key do localstorage, semelhante a esse:

```
import { useEffect } from 'react'

import { read } from 'localstorage-helpr'

/**
* Hook for get LS data and set to a component state, this hook call the `read` method from `localstorage-helpr` lib on component mount and execution.
* @param {string} key LS Key for get Data
* @param {Function} setState Function to set LS data to componente state (ex: reference for `setState` or `setMyData` on component)
*/
export const useGetLocalStorageData = (key, setState) => {
useEffect(() => {
setState(read(key))
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
}

export default useGetLocalStorageData

```

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test path is mentioned. Start by reviewing the package structure and the existing localstorage-helpr read API, then identify where React-facing utilities belong. Done means a custom hook can retrieve a specified localStorage key on mount and update the supplied component state.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
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.