Skip to content

Releases: teafuljs/teaful

0.5.0

22 Oct 21:53
6b55c55

Choose a tag to compare

BREAKING CHANGES

  • We renamed Provider to Store because after the reimplementation it is no longer mandatory to use it because it is no longer a provider, it only makes sense to redefine the store and callbacks. In the future, it will surely have more features.

0.4.1

14 Oct 21:36

Choose a tag to compare

0.4.0

13 Oct 16:34
0ef6eb2

Choose a tag to compare

  • Rename lib to Fragstore
  • Allow fragmented store in more levels
  • Add callbacks
  • Allow store and callbacks to Provider

BREAKING CHANGES

  • Instead of useUsername now is useStore.username(). This allow multi fragment userStore.cart.price(). And for all store is useStore().

0.3.0

30 Sep 18:45
a820cb2

Choose a tag to compare

This introduces callbacks, that are executed for any property change. Is useful for example to fetch data to an endpoint after the state change, and roll back the state if the request fails.

const initialState = {
  quantity: 2
}

// This is new
const callbacks = {
  quantity: (newValue, prevValue, setValue) => {
    // Update quantity from API
    fetch('/api/quantity', { method: 'POST', body: newValue })
     // Revert state change if it fails
     .catch(e => setValue(prevValue))
  }
}

const { Provider, useQuantity } = createStore(initialState, callbacks)

0.2.1

24 Sep 21:54

Choose a tag to compare

  • Avoid error when a property is named store 19c5074

0.2.0

24 Sep 21:29

Choose a tag to compare

  • Rename useUnfragmentedStore to useStore 55a6908

0.1.4

22 Sep 09:12

Choose a tag to compare

  • Update dependencies

0.1.3

12 Mar 23:26

Choose a tag to compare

  • Implement useUnfragmentedStore + add docs

0.1.2

11 Mar 22:04

Choose a tag to compare

Fix bundle

0.1.1

11 Mar 22:00

Choose a tag to compare

Update package