Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const PaymentsFormItems = props => {
const [isReady, setIsReady] = useState(false);
const { cancel, classes, countries, isSubmitting, setIsSubmitting, submit: submitPaymentData } = props;
// Currently form state toggles dirty from false to true because of how
// informed is implemented. This effectively causes this child components
// to re-render multiple times. Keep tabs on the following issue:
// https://github.com/joepuzzo/informed/issues/138
// If they resolve it or we move away from informed we can probably get some
// extra performance.
const formState = useFormState();
const anchorRef = useRef(null);
const addressDiffers = formState.values.addresses_same === false;
const billingAddressFields = addressDiffers ? (
<div>
</div>
<div>
</div>
<div></div>
const SettingsActionBarButtons = () => {
const formState = useFormState()
const formApi = useFormApi()
return (
<>
<button type="button">
</button>
<button> 0 && formState.invalid}
type="submit"
variant="normal"
>
</button>
const PaymentProvider = () => {
const formState = useFormState();
let child;
switch (formState.values.payment_method) {
case 'braintree': {
child = ;
break;
}
case 'braintree_paypal': {
child = ;
break;
}
default: {
return null;
}
const SettingsActions = ({ currentConfig }) => {
const formState = useFormState()
const updatedConfig = merge({}, currentConfig, formState.values)
const overrides = difference(updatedConfig, currentConfig)
const hasChanges = Object.keys(overrides).length
if (!hasChanges) {
return null
}
return (
} />
)
}