export default function Content(props) {
const [lookUp, setLookUp] = useState(null);
return (
<InputBase
sx={{ ml: 1, flex: 1 }}
placeholder="Search links"
onChange={(e) => {
//question is on the following two lines of code
setLookUp(e.target.value);
console.log(lookUp);
if (true) {
props.setLinkList(
props.LinkList.filter((search) =>
search.title.toLowerCase().includes(lookUp)
)
);
}
}}
/>
);
}
NB: notice the comment of the code. As I've described from the code above, the two lines of code are what I'm asking. eg) if I write "er", it logs "e" to the console. then if "e" character and make it "ert" it console "er" to the console. setLookUp is lagging
I want it to log "er" when I write "er" on my InputBase or Textfield. how can I achieve it.? Anyone with the solution please?