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…
Category: Questions
How do you get the place name from a mapbox gl js returned queryRenderedFeatures?
Sample Code Lets say my bounding box is around long/lat [-155.4694, 19.8230], //Mauna Kea My queryRenderedFeatures returns four results which is correct because my bounding box contain 4 national-parks. However I cannot find the place name in the geojson even though all of the national-park names are showing …
Django Cannot auto focus on this form but can on forms
I have a login, register and password reset pages both login and register pages auto focus on the username field however on my password reset page auto focus is not working. I have tried widget_tweaks within my template but to no avail like so: I just cannot get my head around why auto focus works on my other…
Why is my .empty() not emptying the parent element?
I cannot get the jQuery empty method to work on my appended HTML elements. It’s quite a simple problem seemingly, but it has me beat. I’ve tried moving the empty method around in the code but I still cannot get it to empty. Edit: It will not let me edit this unless there is more text so here is so…
Keep getting a DELETE 400 (Bad Request) with my REST API
So, I’ve created a API and I’ve got my POST and GET requests working, but I’m can’t get the DELETE request to work. I keep getting a ‘DELETE http://localhost:3000/api 400 (Bad Request)’ error in the console. Here is the delete section in my server file: Here is the button t…
Initialize js function on the page
I have a js file where there is a function with multiple parameters And I want to use this function on different pages, but with slightly different parameters, let’s say for one of the pages there will be The question is, how do I call this initialization function on the page itself? The usual page for …
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’…
How to log return value after async/await?
Below have I pasted in PoC code, where I have removed lots of lines, but it shows the problem/question I am facing. createPost() returns a “post number” in the ret variable. I don’t need the “post number for anything else than logging it. With the current implementation, I have to defi…
How to get catch error 404 error in Axios?
I have this snippet of code (part of a function), notice the “BadURL” at the end of the URL: import axios from “axios”; But canno’t get into the catch block, says: I can catch the error only if i wrap the function call itself outside the class Answer Axios.post(…) is an asy…
Adding the column name in the table and links in vue
I am beginner web developer. I make my first crud in Laravel 8 and Vue. I use this component t in my project: https://www.npmjs.com/package/vuejs-datatable I have this code: DataTable.vue: Notes.vue: This code work fine. I have 2 problems: I would like the column headers in the table to be taken from: headers…