Skip to content

Releases: teafuljs/teaful

0.4.0

13 Oct 16:34
0ef6eb2
Compare
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
Compare
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
Compare
Choose a tag to compare
  • Avoid error when a property is named store 19c5074

0.2.0

24 Sep 21:29
Compare
Choose a tag to compare
  • Rename useUnfragmentedStore to useStore 55a6908

0.1.4

22 Sep 09:12
Compare
Choose a tag to compare
  • Update dependencies

0.1.3

12 Mar 23:26
Compare
Choose a tag to compare
  • Implement useUnfragmentedStore + add docs

0.1.2

11 Mar 22:04
Compare
Choose a tag to compare
Fix bundle

0.1.1

11 Mar 22:00
Compare
Choose a tag to compare
Update package

We are alive

11 Mar 20:39
Compare
Choose a tag to compare

Initial release 😊