param button . type param button . classes param button . text param button . action export function makeButton ( button ) { const { classes , disabled , label , secondary , type , text } = button ; const builtInButtonTypes = [ 'back' , 'cancel' , 'next' ] ; if ( ! type ) { return button ; } if ( builtInButtonTypes . indexOf ( type ) === - 1 ) { throw new Error ( `'type' property must be one of 'back', 'cancel', or 'next'` ) ; } return { action : this [ type ] . bind ( this ) , classes , disabled , label , secondary , text } ; }