mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Optimize for prop drilling
This commit is contained in:
parent
f77aae6b90
commit
859fd3396b
6 changed files with 28 additions and 43 deletions
|
@ -1,12 +1,10 @@
|
|||
import { useCallback } from '@wordpress/element';
|
||||
import { useAddressEditing } from './useAddressEditing';
|
||||
import useCustomerData from './useCustomerData';
|
||||
|
||||
export const useShippingAddressChange = (
|
||||
fastlaneSdk,
|
||||
setShippingAddress,
|
||||
setWooShippingAddress
|
||||
) => {
|
||||
export const useShippingAddressChange = ( fastlaneSdk, setShippingAddress ) => {
|
||||
const { setShippingAddressEditing } = useAddressEditing();
|
||||
const { setShippingAddress: setWooShippingAddress } = useCustomerData();
|
||||
|
||||
return useCallback( async () => {
|
||||
if ( fastlaneSdk ) {
|
||||
|
@ -14,10 +12,6 @@ export const useShippingAddressChange = (
|
|||
await fastlaneSdk.profile.showShippingAddressSelector();
|
||||
if ( selectionChanged ) {
|
||||
setShippingAddress( selectedAddress );
|
||||
console.log(
|
||||
'Selected shipping address changed:',
|
||||
selectedAddress
|
||||
);
|
||||
|
||||
const { address, name, phoneNumber } = selectedAddress;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue