Refactor store methods to use the 'get' parameter from createStore callback #19

Closed
opened 2024-03-29 18:43:15 +00:00 by tristonarmstrong · 0 comments
tristonarmstrong commented 2024-03-29 18:43:15 +00:00 (Migrated from github.com)

Directions

create store callback

This callback receives a get argument which we can use to grab the current state of the store Creating Store # 2
086fec34be/src/hooks/stationStores.ts (L5)

add method

The former allows us to rewrite the add method and exclude that ugly set state callback we pass to it
086fec34be/src/hooks/stationStores.ts (L6-L14)

rmStation method

This method has the same issue and should also utilize the get function
086fec34be/src/hooks/stationStores.ts (L15-L23)


This should also allow us to remove the ts disable.

# Directions ## create store callback This callback receives a `get` argument which we can use to grab the current state of the store [Creating Store # 2](https://kaioken.dev/docs/api/store) https://github.com/Klectr/KlectrRadio/blob/086fec34be5702776dd83496ab1c2898e7c688e8/src/hooks/stationStores.ts#L5 ## add method The former allows us to rewrite the `add` method and exclude that ugly set state callback we pass to it https://github.com/Klectr/KlectrRadio/blob/086fec34be5702776dd83496ab1c2898e7c688e8/src/hooks/stationStores.ts#L6-L14 ## rmStation method This method has the same issue and should also utilize the `get` function https://github.com/Klectr/KlectrRadio/blob/086fec34be5702776dd83496ab1c2898e7c688e8/src/hooks/stationStores.ts#L15-L23 --- This should also allow us to remove the ts disable.
Sign in to join this conversation.
No description provided.