import React from 'react' ; export default function useControlledComponent < T > ( initialValue ) { const [ value , setValue ] = React . useState ( initialValue ) ; function onChangeText ( newValue ) { setValue ( newValue ) ; } return { value , onChangeText , } ; }