Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished Tech #9

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

Amir-Hackett
Copy link

@Amir-Hackett Amir-Hackett commented Feb 7, 2024

Successful and Unsuccessful getTrending API response

Added error handling to fetchTrending in the useEffect, so whenever the API response is successful, it‘ll set the trending recipes in the setTrendingRecipes state. If the response is empty or invalid, we will let the user know. If there's an error during the API request, it’ll be caught by the catch block, allowing us to handle the error and letting the user know.


API file Consolidation:

Consolidated the API file by combining IncompleteRating and CompleteRating into a single Rating. Using Partial makes the attributes optional in IncompleteRating and removing any unnecessary attribute in IncompleteRating.


ContentContainer Runs Slow and Minimize Rerenders for primeFactorize

Used the useMemo hook to memoize the results of primeFactorize. This makes sure that it doesn't recompute on every render unless the dependencies change.


Bonus Task: Minimize Rerenders as user types

Used the useMemo hook to memorize FormContainer and everything in the array. This way it specifies that it should only be rerendered if something changes.

Amir Hackett and others added 8 commits February 7, 2024 16:13
removed comments when i was working on the file
Updated so if there is no value it will return 0
sometimes my prettier extension changes things i dont need it too
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.

None yet

1 participant