Skip to content

Releases: vivekmunde/duxact

2.4.2

08 Feb 09:55
Compare
Choose a tag to compare

Release notes

  • Source map for Development mode

Breaking changes:

  • None

1.4.1

08 Feb 09:53
Compare
Choose a tag to compare

Release notes

  • Source map for Development mode

Breaking changes:

  • None

2.4.1

02 Feb 05:40
Compare
Choose a tag to compare

Release notes

  • Bug fixes
    • useSelector: The useSelector hook was triggering unnecessary re-renders. This was because the equality function was not receiving the last updated state. It has been fixed now.

Breaking changes:

  • None

2.4.0

02 Feb 05:52
9a0acaf
Compare
Choose a tag to compare

Release notes

  • connect, connectState, useSelector: Facility to pass equality function for state comparison (old vs new state)
  • Documentation update

Breaking changes:

  • None

1.4.0

31 Jan 12:03
Compare
Choose a tag to compare

Release notes

  • connect & connectState: Facility to pass equality function for state comparison (old vs new state)
  • Documentation update

Breaking changes:

  • None

2.3.0

26 Jan 14:21
Compare
Choose a tag to compare

Release notes

  • Hooks
    • useSelector: Hook for consuming state
    • useDispatch: Hook for dispatching actions
  • Test coverage for Deep Comparison for connect, connectState & useSelector
  • Documentation update

Breaking changes:

  • None

1.3.2

26 Jan 14:06
Compare
Choose a tag to compare

Release notes

  • Documentation update
  • Test coverage for Deep Comparison for connect & connectState

Breaking changes:

  • None

1.3.1

30 Nov 04:31
Compare
Choose a tag to compare

Release notes

  • Bundle size reduction
  • Documentation update

Breaking changes:

  • None

2.2.1

30 Nov 04:32
Compare
Choose a tag to compare

Release notes

  • Bundle size reduction
  • Documentation update

Breaking changes:

  • None

2.2.0

24 Nov 15:01
Compare
Choose a tag to compare

Release notes

  • Deep comparison: Deep compare the changed state and old state, state derived from the mapStateToProps selector. It updates the consumer component only if new state (derived from the mapStateToProps) has changed with respect to the old state. This avoids unnecessary re-renders of the consumer components.
    In below example, component UserDetails will receive fresh props, name & address, only if name and/or address of the loggedInUser object gets updated in store. Because the mapStateToProps (selector) returns only the name & address fields of loggedInUser. So even if other data like dateOfBirth, age etc of the loggedInUser are changed, the consumer component UserDetails do not receive freshly mapped name & address, to avoid re-rendering of UserDetails.

Please note, if any parent component in the hierarchy of the UserDetails has re-rendered then UserDetails will also re-render. Its a default behavior of react components. To avoid this use React.PureComponent or React.memo or shouldComponentUpdate.

import { connect } from 'duxact';
  
const mapStateToProps = (currentState) => ({
  name: currentState.loggedInUser.name,
  address: currentState.loggedInUser.address
});

const UserDetails = ({ name, address }) => (
  <div>
    <label>{name}</label>
    <label>{address}</label>
  </div>
);
  
// connect the state to component
const UserDetailsView = connect(mapStateToProps)(UserDetails);

Breaking changes:

  • None