Skip to content
Advertisement

Tag: reactjs

Filtering arrays in JS/React

So here I have search functionality. Everything works fine except when an Item has not been found in the array. I have tried something with objects.Keys but it is displaying it on the render not when the Book has not been found like it should. Should I use if statement or. Answer You’re filtering the category names instead of the

My hooks aren’t opening and closing my modals

I’m new to react and redux, I’m trying to do things the newish hooks way and running into issues opening and closing a Modal using a redux state. Basically, as soon as my page loads, the modal opens, even though the initial state in the slice is set to false and the close button in the modal footer doesn’t close

React Native: Why is Expo-AV not playing audio?

I’m attempting to build an app that acts as a soundboard and can play different sounds when different buttons are pressed. I expected the audio to play but instead, I got an error that stated: This is my code: So far, I’ve tried adding a try/catch block, using different audio formats. I think the error has to do with state

TypeError: unshift is not a function

I have todos array of objects passed as props to a TodoList component. I’m trying to add a new object to the array of objects. I created a method called addTodo which adds the first todo’s object & when I tried to add the second todo it fails with the error: TypeError: this.state.todos.unshift is not a function. Two questions: Why

React hangs when trying to connect to component

For some reason, when trying to connect this component, react simply hangs without giving any error: Presumably the problem is with the profile object. Previously, everything was packaged in variables and everything worked, but now I replaced the variables with an object and react just stopped loading. Answer Try moving the call to standProfilePicture() inside the useEffect hook. A dangling

Advertisement