Skip to content

Commit

Permalink
fix: useEntityStore params
Browse files Browse the repository at this point in the history
  • Loading branch information
2fd committed Mar 20, 2020
1 parent 18bf90f commit d5d5d41
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/hooks/useEntityStore.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { hash } from "immutable"
import { useState, useEffect } from "react"
import EntityStore, { EntityStoreState } from "../utils/EntityStore"

const stores = new Map<number, EntityStore<any>>()

export default function useEntityStore<E extends object>(
identifier: any
store: EntityStore<E>
) {

const key = hash(identifier)
if (!stores[key]) {
stores[key] = new EntityStore<E>()
}

const store = stores[key]
const [state, setState] = useState(store.getState())

useEffect(() => {
Expand Down

0 comments on commit d5d5d41

Please sign in to comment.