Posts by Gabriel José de Oliveira • 1,041 points
42 posts
-
0
votes1
answer17
viewsA: addeventlistener in querySelectorAll in Reactjs
In this case as you have already assigned your function detailsAddress in the event of onClick of his td you can use it to navigate to the parent element, in case the tr, for this just make the…
-
1
votes1
answer24
viewsA: Request Loop in useEffect
Your problem is in your dependencies list useEffect, see that you pass lista in the array of dependencies, and internally you update this state after the request is completed, making this you change…
-
0
votes1
answer65
viewsA: How to extend a global method in tests using globalThis?
I managed to solve the problem by declaring a namespace globalThis and a var with the desired signature, thus: declare namespace globalThis { declare var testRequest:…
-
0
votes1
answer25
viewsA: I’m not getting the form clean
Basically there the problem is that you are just capturing the event of onChange of inputs and storing them in a state, but their inputs are not "synchronized" with that state, so when resetting the…
-
1
votes2
answers48
viewsA: Divs created in Javascript
If I understood your doubt well enough that you create a function that receives the name of the song as parameter and in it you can develop the logic you want, it would be something like this:…
-
1
votes1
answer2038
viewsA: Error: Too Many re-renders. React Limits the number of renders to Prevent an Infinite loop
I believe your problem lies in this part of the component CardAnime. if(anime){ setGeneros(anime.genero.split(",")); if (generos.length > 3) { while (generos.length > 3) { generos.pop(); } } }…
-
1
votes2
answers42
viewsA: useEffect returning null
The way you’re using the useEffect it will run only during the first rendering of your component, such as your list depends on an asynchronous call it will possess the initial value you assigned. if…
-
1
votes1
answer18
viewsA: My list of all is erased when I try to erase only a whole
I believe your mistake lies in this passage: setTodos([ todos.filter(el => el.id !== todo.id )]); The function filter by itself already returns an array, if you do the setTodos this way you will…
reactanswered Gabriel José de Oliveira 1,041 -
2
votes2
answers48
viewsA: Function does not enter useEffect
There are two points in your code that I believe are important you fix and that will probably solve your problem. The function passed to the useEffect should not be a function async, the correct…
-
2
votes1
answer170
viewsA: setInputText is not Assignable to type 'Intrinsicattributes & { Children?: Reactnode; }'
In its component Form you need to type your props, as you are using the React.FC you can pass your props types by Generic that way: import React from 'react'; import { BsPlusSquareFill } from…
typescriptanswered Gabriel José de Oliveira 1,041 -
2
votes1
answer685
viewsA: How to get the url parameter in Nextjs
For you to have this URL format http://localhost:3000/listid/10 just create inside the pages directory following this format: listid/[id].js where listid would be a folder with the page [id].js…
-
0
votes1
answer73
viewsA: How to update Redux’s global status in an React application after posting to the API?
It seems to me that your problem is in your report, more specifically in this section: case TypesPost.NEW_POST: const newPost = state.arrayPost newPost.push(action.payload) return{ arrayPost:…
-
1
votes2
answers164
viewsA: How to Formulate Pattern to Limit Date
Some things are missing in the Pattern you are using, first the character / need escape to work properly, another point is that you need to indicate that your string should contain only these…
-
1
votes1
answer136
viewsA: Add values from a json api and display results // React JS
You can use a reduce to mount an object in the format mesChamado: totalDoMes, first you need to extract the response calls you got from the api: const api = { "chamado": [ { "id": 1,…
-
1
votes1
answer47
viewsA: Single React "key" problem
To summarize, React asks for a prop to be passed key for any component that is within a list. According to React’s own documentation Keys help React identify which items have been changed, added, or…
-
2
votes1
answer58
viewsA: How to catch a json object with match
You can create a new object with the key being the code and the value being the name, for this you can use a for in to traverse the keys of your object in this way: const obj = { "code_name_1001":…
-
4
votes3
answers98
viewsA: Declaring PHP variables from the keys of an array
You can do this way for associative arrays: $array = [ 'a' => 1, 'b' => 2, 'c' => 3, ]; ['c' => $c, 'a' => $a] = $array; Or in the case of a list: $array = [1, 2, 3]; [$a, $b, $c] =…
phpanswered Gabriel José de Oliveira 1,041 -
0
votes1
answer22
viewsA: How to iterate an array a certain number of times in PHP in Codeigniter?
Whereas you want the first 10 elements, you can use the function array_slice php native. $tenStatesArray = array_slice($statesArray, 0, 10);
-
0
votes1
answer45
viewsA: Javascript function that takes two numbers (input) and displays in a list (Alert) with all even numbers between them
Considering that the first number will always be larger than the second, and that you want the even numbers within the range of values received from inputs, you should leave your loop as follows:…
javascriptanswered Gabriel José de Oliveira 1,041 -
0
votes1
answer39
viewsA: How to use the required and check if the data has already been entered?
I believe the problem is in the event you are using to perform the request. How you use the event onClick, the function is being called independent of the inputs whether or not they are completed,…
-
0
votes3
answers174
viewsA: Separates letters by javascript line
You can make a forEach in your array, would look like this: b1.forEach(letter => console.log(letter))
-
0
votes2
answers97
viewsA: Change the label value from a list
It is possible to capture the value of option selected through the event change of select. First I select the element and store within a variable let list = document.querySelector("#lista_servicos")…
javascriptanswered Gabriel José de Oliveira 1,041 -
2
votes3
answers333
viewsA: Return only the positive values of an array
you get the same result using the filter, thus: let saldoPositivo = [100, 20, 0, -10, 10].filter(saldo=> saldo>0) console.log(saldoPositivo)…
javascriptanswered Gabriel José de Oliveira 1,041 -
0
votes1
answer44
viewsA: How do I add an array?
Just access your index array, thus: console.log([i]+":"+powerRangers[i]);
javascriptanswered Gabriel José de Oliveira 1,041 -
0
votes1
answer20
viewsA: When filtering the indices and accessing the same Dice in another vector nothing appears on the screen. Javascript
The problem is due to your comparison index == indices as indices is an array and index an int, it returns false and not the push in its array novoAci to fix this you can make a map in indices and…
javascriptanswered Gabriel José de Oliveira 1,041 -
0
votes2
answers46
viewsA: I can’t make the setTimeout work
Just add the setTimeout within its functions, for example: within its function passar3 you add the setTimeout calling his function passar2, which in turn would also have a setTimeout calling its…
javascriptanswered Gabriel José de Oliveira 1,041 -
13
votes3
answers1299
viewsA: Define whether the letter is vowel or consonant
You can also solve your problem by creating an array of vowels and checking whether the value typed in prompt is inside the array, using the function indexOf, thus: let letra = prompt("Insira uma…
-
1
votes1
answer47
viewsA: Send JSON to a variable outside the function
You can give a myPlaylist.push(json.stories), as myPlaylist is declared as an array in the main scope you can call it smoothly within its function. would look that way in your code: function…
-
5
votes5
answers3663
viewsA: How to scan an array and insert the elements into HTML with JS
You can pass a forEach in the array names that way nomes.forEach(n=>{ item = document.createElement('li') item.textContent = n lista.appendChild(item) }) and within it you create your li, adding…
-
0
votes1
answer53
viewsA: Doubt functioning of JS code
Just let your go that way: for (var i = 0; i < pacientes.length; i++) The length attribute returns the number of items within its array, but the index count starts at 0, so that the last…
javascriptanswered Gabriel José de Oliveira 1,041 -
5
votes1
answer43
viewsA: how to replicate jquery functions in javascript $(), Hide()
To replicate Jquery functions you can use the prototype, for example to make the Hide function would look like this: Element.prototype.hide = function(){ this.style.display = "none"; return this; }…
-
3
votes3
answers153
viewsA: "Javascript function calling child functions"
simply place your code within a single function and call your other functions inside, for example: function init() { // FUNÇÃO DA BARRA DE STATUS ANIMADA var progresso = new Number(); var maximo =…
-
-2
votes1
answer39
viewsA: How to count and make change in all Elementid
using getElementById("id") it will return only the first element with id, so to select all elements with same id we can use querySelectorAll("#id"), which will return all elements with that id. let…
javascriptanswered Gabriel José de Oliveira 1,041 -
3
votes2
answers81
viewsA: How to make the same event work several times in different elements?
You can select all inputs from your form this way let inputs = document.querySelectorAll("input"); Just note that if you with this line all the inputs of the page will be selected, then if you have…
-
1
votes2
answers462
viewsQ: Maximum value of input
My doubt is the following, I would like to know what is the maximum of characters that a tag input text supports, I thank you already for the attention.
-
1
votes2
answers353
viewsA: Problem to print on screen a string with accent
Try replacing your setlocale(LC_ALL, "English"); with setlocale(LC_ALL,"");
-
0
votes2
answers90
viewsA: Use Javascript function within a PHP table column
Try calling the function this way <td> <script>ddTableFilter('<?php echo $row["nome_cliente"]; ?>')</script> </td> just remember to check if the function is already…
-
1
votes3
answers574
viewsA: SLIM FRAMEWORK - 404 PAGE NOT FOUND
all right? Sorry for the delay. I managed to solve your problem, I created a repository with the changes https://github.com/gaoliveira21/stackoverflow-question , basically I deleted the folder from…
-
0
votes3
answers574
viewsA: SLIM FRAMEWORK - 404 PAGE NOT FOUND
just take the second bar on the route, for example $app->get( '/login', function () { require_once("login.php"); } ); $app->get( '/dashboard', function () { require_once("dashboard.php"); } );…
-
0
votes2
answers65
viewsA: Problems with Collapse Bootstrap
this is probably because the data-target and id are always the same. you’re creating them all with the same id, I believe that’s why. tries to add a variable to change the id and data-target as…
-
0
votes2
answers317
viewsA: JS: Add an icon to an event to change the background and bring up content
var TodosIcones = document.querySelectorAll('.icon-visual'); var content = document.querySelectorAll(".financeiro, .mensalidade"); for (var i = 0; i < TodosIcones.length; i++) {…
javascriptanswered Gabriel José de Oliveira 1,041 -
0
votes1
answer102
viewsA: set select option to Selected with value coming from a JSON
If you have the status id within the Hidden input you can make a comparison between its value and what you have within the select. with the code below I took the options and stored in the states…