Similar to useDynamicValue. The difference is that the returned state is
only the current value and no setter.
const value = useDynamicValue(dynamicValue, defaultValue, replay);dynamicValue: DynamicValue- The dynamic value to subscribe to.defaultValue: any- The default value of the state. If the dynamic value initially already has a value, it is used instead ofdefaultValue.replay: boolean- Used as the second argument toDynamicValue.subscribe. This means that, if set tofalse, the current value of the dynamic value is not ignored. Defaults totrue.
import { useDynamicValue } from '@deutschesoft/use-aux-widgets';
function Channel(props) {
const { mute$ } = props;
const muted = useDynamicValue(mute$);
return (
<div className="channel">
<button>{muted ? 'Muted' : 'Not Muted'}</button>
</div>
);
}