Hook up TextControlWithAffixes to state for interactivity.

This commit is contained in:
Jeff Stieler 2018-12-12 23:15:39 -07:00
parent 44f025f308
commit e3be069601
1 changed files with 12 additions and 2 deletions

View File

@ -1,21 +1,31 @@
```jsx
import { TextControlWithAffixes } from '@woocommerce/components';
const MyTextControlWithAffixes = () => (
const MyTextControlWithAffixes = withState( {
first: '',
second: '',
third: '',
} )( ( { first, second, third, setState } ) => (
<div>
<TextControlWithAffixes
prefix="Prefix"
placeholder="Placeholder text..."
value={ first }
onChange={ value => setState( { first: value } ) }
/>
<TextControlWithAffixes
prefix="Prefix"
suffix="Suffix"
placeholder="Placeholder text..."
value={ second }
onChange={ value => setState( { second: value } ) }
/>
<TextControlWithAffixes
suffix="Suffix"
placeholder="Placeholder text..."
value={ third }
onChange={ value => setState( { third: value } ) }
/>
</div>
);
) );
```