UNPKG

@gechiui/compose

Version:
20 lines (14 loc) 512 B
# withInstanceId Some components need to generate a unique id for each instance. This could serve as suffixes to element ID's for example. Wrapping a component with `withInstanceId` provides a unique `instanceId` to serve this purpose. ## Usage ```jsx /** * GeChiUI dependencies */ import { withInstanceId } from '@gechiui/compose'; function MyCustomElement( { instanceId } ) { return <div id={ `my-custom-element-${ instanceId }` }>content</div>; } export default withInstanceId( MyCustomElement ); ```