Skip to content

How to setState in callback instead of Session variable? #3

@ghost

Description

Hello,

I'm trying to save state in callback like

MeteorCameraUI.getPicture( { cameraOptions }, function( error, data ) {
      if (error) {
        console.log(error);
      } else {
        this.setState({
          image_data: data
        });
      }
    });

... getting: TypeError: this.setState is not a function

Also tried with setting binding like this

MeteorCameraUI.getPicture( { cameraOptions }, function( error, data ) {
      if (error) {
        console.log(error);
      } else {
        this.setState({
          image_data: data
        });
      }
    }.bind(this));

same result.

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