I'm trying to create a component which has very less dependencies and requires almost no extra code for using it inside another component. I'm stuck where i need to set the state because setState method requires this context. 
Currently I'm sending this, as a context to the method defined in my Library Component.
export const showSnackbarNotification = (context, msg, variant) => {
  context.setState({
    [`notificationMsg`]: msg, 
    [`notificationToggle`]: true,
    [`variant`]: variant
  })
}
And I'm calling this function like below:
showSnackbarNotification(this, "checking the function", "error");
But I don't want the user to send this context via method parameter. Is there any way that i can execute the method with the context of where it is called. So showSnackbarNotification definition becomes: 
export const showSnackbarNotification = (msg, variant) => {
  this.setState({
    [`notificationMsg`]: msg, 
    [`notificationToggle`]: true,
    [`variant`]: variant
  })
}
and still set the state of Component where i called showSnackbarNotification method.
 
    