import * as React from 'react' ; import { counter , getId , getPrefix , UIDProps } from "./context" ; const prefixId = ( id , prefix , name ) => { const uid = ( prefix + id ) ; return String ( name ? name ( uid ) : uid ) ; } ; deprecated see https example export class UID extends React . Component < UIDProps > { state = { quartz : this . props . idSource || counter , prefix : getPrefix ( this . props . idSource ) , id : getId ( this . props . idSource || counter ) } ; uid = ( item ) => prefixId ( this . state . id + '-' + this . state . quartz . uid ( item ) , this . state . prefix , this . props . name ) ; render ( ) { const { children , name } = this . props ; const { id , prefix } = this . state ; return children ( prefixId ( id , prefix , name ) , this . uid ) ; } }