I get the following error when trying to run my react site: “Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it’s defined in, or you might have mi…
Tag: reactjs
How to fix a this react filter?
I have created a database in firebase and I have fetch it in react, that is working correctly, but I want to include a search bar to filter the elements, my problem is that when I search for an element everything works but when I delete the text from the search input the elements do not appear again. Answer Y…
How to use conditional rendering inside map in React
I have a react page that is rendering a list of products that are being returned from a GraphQL API. Once the products are returned, I’m storing them in a state and then render them. How do I only render products that meet certain conditions? Right now, I’m mapping over the products and rendering …
Wait Until Data is Fetched from MongoDB React JS
I’m creating a Quiz App. This is the Quiz Page Code. Quiz DB Document contains a QuizQuestions Array which has question ids. Then I fetch specific question from MCQ/Question DB. Fetching MCQ takes time and when I console.log fetched data. First and second time data in undefined then its viewable. Due to…
I cannot find the error TypeError: Cannot read properties of undefined (reading ‘name’)
I’m new to react and I need some help when I´m trying to bring some “products” from an array of objects that I have in one file of my react app called “products.js”. The thing is that I am able to draw the products within the array in the Home Screen. However when I try to draw t…
ReactJS: Expected property shorthand object-shorthand
I have a form with a submit. When it is clicked I create an object to send these data to POST. So I have saveEntity const: I need to recreate this object structure: or Now I receive this error: Expected property shorthand object-shorthand Now usually i resolve writing directly in this way: but it doesn’…
Unable to run JEST test
I’m facing an issue when I try to import something using require() function in jest test file. script2.test.js Package.json babel.config.cjs I’m getting following errors when I run the test using npm test I’m new to JEST, any help is much appreciated. My Node version is 14.17.3 Thanks you. A…
Rewrite this Firebase Web SDK Version 8 syntax into Version 9
I have a problem with Firebase in my React Native app. I’ve found a quick fix online, but it’s written in Firebase Web version 8 syntax: How can I rewrite it in Version 9 syntax? Answer You need to pass your settings to the initializeFirestore(app, settings) method. As you will read on this doc pa…
How to create schema customization to use optional field “featureImage” from gatsby blog
I’m making a Gatsby blog as a side project. I want to use the “featureImage” optional field in mdx frontmatter. I tried to refer to the https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization#creating-type-definitions document according to the error message, but it wa…
React Firebase deleting the wrong document id
I’ve been trying to make a delete operation on a firebase database using Reactjs. I’ve got a bug with my function grabbing the wrong id from firebase. I have a button that calls a handleOpen function which opens a Modal. Modal operations: I’ve got a button that calls a handleDelete function …