Skip to content

Review challenge request#1

Open
marius4896 wants to merge 2 commits into
mainfrom
buy-ticket-feature
Open

Review challenge request#1
marius4896 wants to merge 2 commits into
mainfrom
buy-ticket-feature

Conversation

@marius4896

Copy link
Copy Markdown
Owner

No description provided.

@marius4896 marius4896 self-assigned this Sep 27, 2021

@marius4896 marius4896 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

You are on the right path :)

Comment on lines +60 to +63
Alert.alert(
t.myBooking.successReservation.title,
t.myBooking.successReservation.message,
);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Not a common practice to add this here. Place it as part of the success action itself

Comment on lines +73 to +76
Alert.alert(
t.myBooking.errorReservation.title,
t.myBooking.errorReservation.message,
);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Not a common practice to add this here. Place it as part of the success action itself

/>
<Stack.Screen
name={'BookingScreen'}
component={() => <Booking />}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

If your are not passing extra props to the screen component use it as component={Booking}

Comment on lines +28 to +29
const setCabinVal = () => setState({...state, cabin: !state.cabin});
const setCheckedVal = () => setState({...state, checked: !state.checked});

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Using set state like this can help with much boilerplate, bui i would consider useState for each pro, and in this example wrap it in a useCallback.

As an alternative use useReducer.

Comment on lines +5 to +8
marginLeft: 15,
marginRight: 15,
marginBottom: 15,
marginTop: 15,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Using fixed values can work, and it will work for one screen with it's dimensions, but you will have problem scaling. Please use either percentages or relative values.

payload: {reservationId: response.data.reservation_id},
});
})
.catch((error) => console.warn(error));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Maybe dispatch(BUY_TICKET_FAIL) rather than logging in the error.

@@ -0,0 +1,53 @@
// @ts-nocheck

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

why this here ?

price: string;
}

export default class BaggageClassComponent extends React.Component<BaggageItemProps> {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Why use class component here ? Please move to functional.

import {flights} from '../../data';

const Connections = () => {
type Props = {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Please use an interface.

import {Action} from 'redux';
import {t} from '@translations';

export const BUY_TICKET_REQUEST = 'BUY_TICKET_REQUEST';

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

You can transform this in an Enum

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