Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some caveats to read me #92

Closed
wants to merge 1 commit into from

Conversation

rickgaurav
Copy link

Add some points which are easy to be missed but are really required to be taken care of, in order for tracking to work correctly.

@tizmagik
Copy link
Collaborator

Thanks @rickgaurav ! This is noted early in the doc,

The decorator can be used on React Classes and on methods within those classes. If you use it on methods within these classes, make sure to decorate the class as well.

Maybe we can make that more obvious instead of adding this new "gotcha" section? Could add a comment to the code snippet perhaps. Something like:

import React from 'react';
import track from 'react-tracking';

@track({ page: 'FooPage' })
export default class FooPage extends React.Component {
  @track({ action: 'click' }) // be sure to have decorated the class for this to work
  handleClick = () => {
    // ... other stuff
  };

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

@tizmagik
Copy link
Collaborator

I think this might also be helpful for a future FAQ I'd like to put together, #86

@rickgaurav
Copy link
Author

Ahhh, I missed it. I guess its emphasised enough then. Adding a comment in code is enough. I will close the PR.

@rickgaurav rickgaurav closed this Sep 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants