Skip to content

How to use Trello object in another component #12

@naelleawayes

Description

@naelleawayes

Hi,

For starters, please forgive me if the answer to my question seems obvious, i'm a newcomer to react.
I read issue #4 and tinkered a lot with my project to try and make it work, but to no avail.

I have a component called Login which renders <TrelloClient /> and the authorization goes fine, and if I call Trello.rest("GET", "/members/me", res => console.log(res), err => console.log(err)) in authorizeOnSuccess it executes perfectly.

However, if in the authorizeOnSuccess function I decide to navigate to my other component (using reach-router), and in that component I try calling Trello.rest("GET", "/members/me", res => console.log(res), err => console.log(err)) in the componentDidMount method, I get this error :

react_trello_client__WEBPACK_IMPORTED_MODULE_2__.Trello.rest is not a function

I might be wrong on this one, but it seems to me that the Trello object resets once I navigate although I assumed it would be set globally.

Could you please point to me what I'm doing wrong ?

Thanks in advance,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions