import React from 'react'; import { useForm, Controller } from 'react-hook-form'; import NumberFormat from 'react-number-format'; import { TextField, ThemeProvider, createMuiTheme } from '@material-ui/core'; const theme = createMuiTheme({ palette: { type: 'dark', }, }); const defaultValues = { priceInCents: 1234567, muiPriceInCents: 1234567, }; function App() { const form = useForm({ defaultValues }); const onSubmit = (data) => { form.reset(defaultValues); }; return ( Price Material UI Price } /> form.reset(defaultValues)} value="Custom Reset" /> {JSON.stringify(form.watch(), null, 2)} ); } const MuiCurrencyFormat = (props) => { const { onChange, value, ...rest } = props; return ( { onChange(target.floatValue); }} isNumericString prefix="$ " /> ); };
{JSON.stringify(form.watch(), null, 2)}