Last active
February 8, 2024 11:24
-
-
Save cdsandoval/30a29182516d13c510b30df92ab09704 to your computer and use it in GitHub Desktop.
useMemo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Component(){ | |
const [searchTerm, setSearchTerm] = React.useState("") | |
const filterWithGoodName = React.useMemo(() => { | |
return searchTerm.filter(.....) | |
}, [searchTerm]) | |
return ( | |
<input onSearch={setSearchTerm}/> | |
} | |
// Aunque lo ideal seria remover el estado de searchTerm y que el useApolloTableQuery devuelva el valor de search que tiene, como lo hace con el onSearchChange. | |
// Asi evitamos tener 2 estados para lo mismo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment