// Import your Hop SDK instance
import {hop} from '.';
const channelId = 'channel_xxx'; // the channel we want to update
/*
* - Option 1: Rewrite the state.
* - The existing state is passed as the first arument to Channel#setState
*/
hop.channels.setState(channelId, s => ({...s, name: 'My Channel'}));
/*
* - Option 2: Update or add variables
* - This operation will only effect the variables you specify.
* - The rest of the state will remain unchanged
*/
channel.patchState(channelId, {name: 'My Channel'});