Dictionary Web App using React + Emotion

Solution retrospective
In this project, I learned to use different common react hooks.
a. useEffect to watch certain state and apply side effects like fetching API response or update other states
import { useEffect } from 'react';
useEffect(() => {
if (currentKeyword === '') return;
getVocabDefinition(currentKeyword);
}, [currentKeyword]);
b. useContext to provide context accross components. This hook is similar to the provide/inject syntax provided by Vue3
import { createContext, useContext } from 'react';
type TypeCurrentKeywordContext = {
currentKeyword: string;
handleSearch: (keyword: string) => void;
};
const CurrentKeywordContext = createContext(
null
);
const { handleSearch } = useContext(
CurrentKeywordContext
) as TypeCurrentKeywordContext;
I also tried Redux to manage the global state to toggle the app's dark/light theme
What specific areas of your project would you like help with?Any suggestions are welcomed. Thank you.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Joanne Wang's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord