Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

useEffect do not fire when cart state is updated #13

Closed
vrease opened this issue Nov 1, 2020 · 2 comments
Closed

useEffect do not fire when cart state is updated #13

vrease opened this issue Nov 1, 2020 · 2 comments
Labels
question Further information is requested

Comments

@vrease
Copy link
Contributor

vrease commented Nov 1, 2020

FIrst. Really love use-local-storage-state. Good work! 馃挴

Issue: useEffect do not fire when cart state is updated. Any idea why?

useCart.js

import { createLocalStorageStateHook } from 'use-local-storage-state'

const useCart = createLocalStorageStateHook('cart', {})

export default useCart

cart.js (simplified)

import useCart from '../utils/useCart'

const [cart, setCart] = useCart()

 useEffect(() => {
        //fetch product details
    }, [cart])
@astoilkov
Copy link
Owner

I couldn't replicate the issue. Can you reproduce the problem in the example here.

@vrease
Copy link
Contributor Author

vrease commented Nov 1, 2020

My bad! I updated state in a bad way. Works fine now! Thanks for the reply!

@vrease vrease closed this as completed Nov 1, 2020
@astoilkov astoilkov added the question Further information is requested label Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants