Try to use useDiscountCodes API in javascript , but always fail ..

How to use javascript to access the standard api or other use api , I have extension like this at begin

export default extension( “purchase.checkout.contact.render-after”, ( root, { ui, applyAttributeChange, applyShippingAddressChange, api } ) => {

And if I use this will fail

const discountCodes = api.useDiscountCodes();

Current I only can use the applyXXXXX function, Can’t find way to use standard api or function that start with useXXX.

Can someone give me some direction to learn. Thank you.