score:1

login((message) => {
     this.changeMessageState(message)
})

score:4

function changeMessageState(component, message) {
  component.setState({
    message,
  });
}

// then in your components
changeMessageState(this, message)

Related Query

More Query from same tag