Skip to content

Releases: pedronauck/reworm

v2.0.2

06 Oct 00:16
Compare
Choose a tag to compare

Changelog

🚀  Features

  • feat: add Provider because of suspense features
  • feat: add subscribe method

⚠️  Breaking Changes

Now you need to wrap your entire application using reworm provider!

import React from 'react'
import { Provider, create } from 'reworm'

const { get } = create({ name: 'John' })

const App = () => (
  <Provider>
    <div>{get(s => s.name)}</div>
  </Provider>
)

Listening state changes

If you want to listen changes on your state you can use subscribe():

import React from 'react'
import { Provider, create } from 'reworm'

const user = create()

class App extends Component {
  state = {
    name: 'John'
  }

  componentDidMount() {
    user.subscribe(name => this.setState({ name }))
    user.set('Michael')
  }

  render() {
    return <div>Hello {this.state.name}</div>
  }
}

v1.0.4

22 Aug 00:37
Compare
Choose a tag to compare

Changelog

🐞  Bug Fixes

  • fix: add build pre release (12fdd1e)

v1.0.3

22 Aug 00:29
Compare
Choose a tag to compare

Changelog

🐞  Bug Fixes

  • fix: remove deepmerge to prevent wrong merges (3578ff2)

v1.0.2

22 Aug 00:06
Compare
Choose a tag to compare

Changelog

⚡️  Improvements

  • perf: change state to be in component instance (ebfb176)
  • chore: change selector parameter name (#10) (c4c49c5)

v1.0.1

21 Aug 20:51
Compare
Choose a tag to compare

Changelog

🐞  Bug Fixes

  • fix: resolve state as primitive types (997cf46)

v1.0.0

21 Aug 18:09
Compare
Choose a tag to compare

Changelog

⚠️  BREAKING CHANGE

  • refactor: remove context and state provider (34523c3)

Now you don't need to use the <State> component as provider for state, just use get, set or selectors on the fly wherever you want:

import React from 'react'
import { create } from 'reworm'

const { set, get } = create({ name: 'John' })

class App extends React.Component {
  componentDidMount() {
    set(prev => ({ name: 'Peter' + prev.name }))
  }
  render() {
    return (
      <div>{get(s => s.name)}</div>
    )
  }
}