Code
Props
Props
Data Type
Required
Event Response
Property
Data Type
onChange
Components Dependency
Live Demo
React
Last updated
Last updated
import React, {useState} from 'react';
import {Switch} from '@2600hz/sds-react-components';
const Example = ()=>{
const [switchSelection, setSwitchSelection] = useState(false);
const updateState = (e)=>{
setSwitchSelection(e.checked);
}
return(
<div className='container'>
<Switch
id='first'
value='element1'
label='Element 1'
onChange={updateState}
/>
</div>
)
}