Skip to content

Feature/annimations#6

Open
joaquinVidal1 wants to merge 21 commits into
mainfrom
feature/annimations
Open

Feature/annimations#6
joaquinVidal1 wants to merge 21 commits into
mainfrom
feature/annimations

Conversation

@joaquinVidal1

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/application/App.tsx Outdated
const PurchasesNavigator = createNativeStackNavigator<PurchasesParamList>();
const AppNavigator = createDrawerNavigator();

const StoreFlow = () => (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estos Navigators los podes separar a archivos diferentes con toda su logica para que te quede mas limpio el archivo App.tsx

const {width} = useWindowDimensions();

const cart = useAppSelector(state => state.cart.cart);
const explote = useCallback(async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este callback puede recibir al cart como parámetro y que el array de dependencias te quede vacío. Hace que el use effect quede dependiente del cart y que llame a este callback adentro. Me da la sensación de que queda mas claro de que vos queres ejecutar la función siempre que cambie el cart y eso lo vas a hacer con el useffect que tenes abajo. De la otra forma el useffect se vuelve a ejecutar cuando se vuelve a definir la función explote, que termina siendo lo mismo pero no queda muy claro lo que queres hacer

<CartItem
product={item}
style={
index !== purchase.items.length - 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aca podes usar el operador &&

export const getPurchases = (): Promise<Purchase[]> => {
return instance
.get('/purchases')
.then(response => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tener presente que tambien se puede usar el async await

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants