Skip to content

Tag: reactjs

Replace setTimeout in useEffect when waiting for props

I am looking for a better solution to using setTimeout to wait for props using the useEffect() hook. Currently I have working as intended whereas props.credentials in it’s initial state is {}, awaiting a response from the server to give the value for verifiedEmail and sessionCookie relies on a function …

Applying multiple filters to an array javascript

I’m having trouble applying and using two filters to an array. I have an array of files which two attributes: a filename and a file extension. Those files are displayed in a list in a view. There are two options for filtering the list — with a simple text filter and a select dropdown based on the …

Fetched Object from API doesn’t appear in mapping

I call a get request to my api, and then register them to my state with this: I even tried the axios approach: If I console.log posts_data and posts, it gives me the Object I got from my api: But whenever I iterate and display it: It doesn’t show up on the page. I even tried adding that random string

How make filter in sub component in reactjs?

The list doesn’t update after sorting in the parent component. console.log(‘sortedList’, sorted); – sort correctly ListFilter component: What is wrong? Answer The re-render is skipped because you have mutated state. It was mutated from within a child component making it even harder to …