Posts by Danúbio Vieira Lima • 397 points
17 posts
-
-1
votes2
answers49
viewsQ: How to remove ZIP code and country from a string
I’m using Javascript to manipulate some strings that comes from an API and I need to remove the zip code and country from one of these strings. Basically, I get the phrase like this: "R. Anderson…
-
2
votes1
answer223
viewsQ: How to style HTML5 calendar icon
I have an HTML5 input with type="date", thus: <input type="date"> Is there any way to change the color of the calendar icon it brings natively? I’ve tried properties like…
-
2
votes1
answer73
viewsQ: How to use the React useRef hook with the Numberformat component?
I am using the lib react-number-format to take a value as formatted currency in my form and then save it to a state. Currently it is this way: <NumberFormat thousandSeparator={true}…
-
1
votes1
answer194
viewsQ: How to use a date mask at Angular 10
I have a form in my application where the user can edit various data, including his date of birth. In the edit date field I am using this input: <div class="col-md-6"> <label…
-
0
votes2
answers1497
viewsQ: How to use the Material Ui autocomplete Component without errors
I have a component Autocomplete of the Material UI where the user searches the values based on an array of products that comes from an API. The component is like this, where products is the array,…
-
1
votes2
answers256
viewsQ: Adding a value to an object array with reduce
I have an array of objects that follow this format: [ { name: 'Batata', points: 23, }, { name: 'Pizza', points: 50, }, { name: 'Tacos', points: 60, }, ]; I want to go through this array and get the…
-
2
votes1
answer1301
viewsQ: Validating password confirmation in Yup with React
I have to validate a form where the user can update his password, I’m using Yup to do this. My code is like this: const schema = Yup.object().shape({ name: Yup.string().notRequired().min(3, "O nome…
-
-1
votes1
answer127
viewsQ: How to render a modal on a map using React?
I have an application in React that searches products of an api, I want to render a table where each item has a button that opens the modal and updates (sends a PUT in the API) the product. Only the…
-
2
votes1
answer128
viewsQ: Map method is undefined in React
I’m building an application in React and need to render a list of all users, called the API. Use the map to go through the users, but the browser returns the error: TypeError: Cannot read property…
-
3
votes1
answer109
viewsQ: How to use await instead of . then() in Javascript?
I have this asynchronous code: const delay = () => new Promise(resolve => setTimeout(resolve, 1000)); async function umPorSegundo(){ console.log(await delay(), '1s') console.log(await delay(),…
-
1
votes2
answers347
viewsQ: Use Axios to generate an unordered list using the Github API
I have a code that should receive the client’s Github username and generate a list with the name of its repositories. The list is generated, but always returns undefined. The result would be…
-
0
votes1
answer1005
viewsQ: How to make a file return a value after 2 seconds
I have the following code: var age = parseInt(prompt('Digite sua idade: '), 10); function verificar(age){ return new Promise(function(resolve,reject){ if(age > 18){ resolve() }else{ reject() } })…
-
2
votes1
answer25
viewsQ: Error on a JS Promise
I have the following code: var age = parseInt(prompt('Digite sua idade: ')); function verificar(age){ return new Promise(function(resolve,reject){ if(age > 18){ resolve(console.log('DEU CERTO'))…
-
1
votes1
answer45
viewsQ: Create style for various dynamically generated elements
I have the following function, which creates blocks dynamically: function criar(){ let box = document.querySelector('.box'); box.style.display = 'flex' let element = document.createElement('div')…
-
0
votes2
answers174
viewsQ: Create stylized HTML element using Javascript
I’m trying to create a red block on the page using HTML, but for some reason the code doesn’t work. The browser console does not return any error and nothing happens on screen. The program is like…
-
4
votes5
answers3663
viewsQ: How to scan an array and insert the elements into HTML with JS
I am studying the DOM of JS and had some difficulties. I need to show the elements of this vector as li tags of HTML: let nomes = ["Diego", "Gabriel", "Lucas"]; My code is this: function gerar(){…
-
2
votes2
answers544
viewsQ: How to scan an array of objects and return their values in a string
I have this vector of objects here: var usuarios = [ { nome: "Diego", habilidades: ["Javascript", "ReactJS", "Redux"] }, { nome: "Gabriel", habilidades: ["VueJS", "Ruby on Rails", "Elixir"] } ]; and…