Skip to content

Releases: nytimes/react-tracking

v7.2.1

22 Oct 20:11
Compare
Choose a tag to compare

Patch update in #143 by @tizmagik and #144 by @bgergen to follow React Hooks lint rules

v7.2.0

18 Oct 20:23
Compare
Choose a tag to compare

Thanks to @bgergen in #142 react-tracking now uses React Hooks under the hood 🎉

This means better compatibility with libraries that use the Legacy Context API and helps pave the way for more advanced feature support in the useTracking() hook (E.g. allowing for adding to the tracking context via the hook without having to use the higher-order component/decorator, #138 ).

v7.1.0 - Performance upgrade

30 May 17:17
Compare
Choose a tag to compare

Performance upgrade

Thanks to @BRKalow and @jacekradko in #129 react-tracking now makes better use of the context API to avoid unnecessary re-renders. If you're on v6 or above, be sure to upgrade! 🔥

Other changes in this release:

In #130 by @tizmagik

  • We no longer export ReactTrackingContext, user-land shouldn't need this export given the useTracking hook and track higher-order component (please open an issue if you have a use case!)
  • In addition to the default export, you can now also import { track } from 'react-tracking';

v7.0.2

21 May 20:47
Compare
Choose a tag to compare

Patch release, setting sideEffects: false in package.json

v7.0.1

21 May 19:22
Compare
Choose a tag to compare

Move core-js@3 to a direct dependency. This means a +40KB reported in bundlephobia, although that's a bit misleading because we don't use all of core-js.

Better approach TK, follow along in: #127

v7.0.0 - React Hooks support

20 May 20:49
Compare
Choose a tag to compare

2 Breaking Changes, although the syntax/API has not changed:

New Feature: React Hooks

Thanks to @damassi in #124 we now support React Hooks 🎉

import { useTracking } from 'react-tracking';

const SomeChild = () => {
  const tracking = useTracking();

  return (
    <div
      onClick={() => {
        tracking.trackEvent({ action: 'click' });
      }}
    />
  );
};

useTracking returns the same { getTrackingData, trackEvent } methods that the @track() wrapper injects into props (as props.tracking). For now, you still need to use the wrapper in order to add contextual tracking data.

Technically the syntax is backwards compatible, but because of our use of React Hooks we now require React > v16.8, hence the breaking change.

peerDependencies Update: core-js@3

Thanks to @mckernanin in #125 we've upgraded our babel and core-js dependencies.

For more on this upgrade and how this might affect your app's build/configuration, please see: https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md

Again, syntax is backwards compatible, but peerDeps now specified an update to core-js@3 if you didn't already have it.

v6.0.0 - Use new React Context API

24 Apr 21:36
Compare
Choose a tag to compare

There are no breaking API changes, but we now use the new React Context API under the hood so the minimum React version is now 16.3+

If you're on an old version of React (<16.3) you can still use react-tracking v5.7.x

v5.7.0

16 Mar 18:23
Compare
Choose a tag to compare

Just a dependency update, #117

v5.6.0

25 Oct 20:54
Compare
Choose a tag to compare

Thanks to @williardx in #105 we now avoid dispatching a tracking event when your decorated class member tracking call returns a falsy value:

@track({ module: 'button' })
class Thing extends Component {
  @track(() => {
    // some logic that eventually returns:
    return false; // won't dispatch
  })
  handleClick = () => { ... }

  render() {
    return <button onClick={this.handleClick}>Click me</button>
  }
}

v5.5.4

19 Oct 17:05
Compare
Choose a tag to compare

In #103 fixes { dispatchOnMount: true } behavior when process() function returns a falsey value (it will now always dispatch when the component mounts, as expected).