handle used URLs nicely
This commit is contained in:
@@ -16,7 +16,9 @@ const stateContext = React.createContext<StateContext>(undefined)
|
||||
const setContext = React.createContext<SetContext>((_: StateContext) => {})
|
||||
|
||||
export function Provider({children}: {children: React.ReactNode}) {
|
||||
const [state, setState] = React.useState<StateContext>()
|
||||
const [state, setState] = React.useState<StateContext>(() =>
|
||||
persisted.get('currentStarterPack'),
|
||||
)
|
||||
|
||||
const setStateWrapped = (v: StateContext) => {
|
||||
setState(v)
|
||||
|
||||
@@ -9,9 +9,12 @@ const stateContext = React.createContext<StateContext>([])
|
||||
const setContext = React.createContext<SetContext>((_: string) => {})
|
||||
|
||||
export function Provider({children}: {children: React.ReactNode}) {
|
||||
const [state, setState] = React.useState<StateContext>([])
|
||||
const [state, setState] = React.useState<StateContext>(() =>
|
||||
persisted.get('usedStarterPacks'),
|
||||
)
|
||||
|
||||
const setStateWrapped = (v: string) => {
|
||||
console.log('ADDING!!!', v)
|
||||
persisted.write('usedStarterPacks', [...(state ? state : []), v])
|
||||
setState(prev => [...(prev ? prev : []), v])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user