Posts by novic • 35,673 points
1,265 posts
-
2
votes1
answer61
viewsA: How do I get a simple change of status from a chekbox in React?
To rescue the state of a checkbox create a true or false state variable (true/false) and in the checkbox configure as follows: code: const [check, setCheck] = React.useState(false); and in the…
-
1
votes1
answer37
viewsA: How do I return the property of a class to an object of a function?
In addition to changing self for this (class scope) the items in your construtor the method getPropert is to return an object, and object in javascript has key and value and in case the question…
-
-1
votes1
answer123
viewsA: Always rendering all the code, changing state!
I’m realizing that wrote more than needed, I decided to create a minimal example demonstrating the rendering only of the clicked component, with useCallback and memo which checks fairly if the value…
-
2
votes2
answers58
viewsA: Change the array data coming from the api
Create a new array with map that will go through all the items and Object.assign that can add new elements to each object, example: const data = [{ id:1, name:'product01'}, {id:2, name:'product02'…
-
1
votes1
answer40
viewsA: Problems consuming api - React
Your code has one Promise who has another Promise within a function resolve of the first Promise, and none of this is necessary, because, the axios already returns a Promise and can be solved…
-
1
votes1
answer44
viewsA: Delay or not sending the data to the back-end, what to do?
In the React the concept of state is one of the most important, the way you are using is not the way that the React makes to recover state of by examples of <input />. The basic code to…
-
1
votes1
answer77
viewsA: Sum checkbox with predefined values. Javascript
Your code is very verbose and with some problems (for example, using the function parseInt instead of parseFloat being used for values with comma), can search the selected elements and scan (for)…
-
1
votes1
answer25
viewsA: Create click event for multiple C#buttons
A method needs to be created with the following signature: private void Button_Click(object sender, EventArgs e) { Button clicado = (Button)sender; MessageBox.Show(clicado.Text); } and at the time…
-
6
votes1
answer122
viewsA: What is the prop "key" for in React?
What is this property for key To uniquely identify each element or component that will be created, modified, deleted and/or selected from a list of values (array), that is, is linked to the creation…
-
0
votes1
answer30
views -
1
votes1
answer42
viewsA: Pass values from a Usercontrol to the parent Form
Yes, it is possible. Form 1 In the creation of their Usecontrol add a method GetText() that returns the value (property Text) of control Textbox for that method where the Form can redeem and use the…
-
1
votes1
answer61
viewsA: Divs render but no past data appears, React
Only need in variable list store the result of API then use this variable to map the component Cards, example: const data = [ { url: 'https://via.placeholder.com/150.png/091/fff' }, { url:…
-
3
votes2
answers223
viewsQ: Cookie and sharing between subdomains?
I have a website with the following address http://www.mysite.com.br that in programming back-end is created some cookie settings and even information with encrypted data. A subdomain has now been…
-
2
votes1
answer43
viewsA: How to add new object at specific position of useState Hooks array
Using map to interact on each item of your array and the filtro that will bring the filtered data of the other array can assemble the structure as shown in the question, example: function App() {…
-
2
votes1
answer56
viewsA: How to show a DIV and hide others with Javascript?
Well, each one has a style, I first started all the elements to display = none and as you choose in the check box take the same value and have it show with the same name as the div, example:…
javascriptanswered novic 35,673 -
0
votes1
answer22
viewsA: Sqlbuilder + Codeigniter v.4.1.1
You don’t have to do what you want to do in the model can directly use the methods that the model has that is much more logical and easier for maintenance, although it lacked to call the method at…
-
0
votes1
answer41
viewsA: How to include multiple texts in an array in the same function?
There is the simplest solution that is to create a array and added the values and finally update the state of the component, the more complex solution also gives, but maybe it is complicating what…
-
3
votes2
answers57
viewsA: Problem with clearInterval in React
Failed to manage which variable is storing the interval (the setInterval returns a value that is the created range and this value is used to stop this timer) and with the programming using the Hook…
-
2
votes2
answers167
viewsA: Reactjs Toggle onClick variable
When working with several states and several <button/> Each button has to have its own state, so that it has its own control and does not clash with the other states. It can be done in several…
-
1
votes1
answer25
viewsA: Grab specific part of a Vb.net string
You can use the method Split class String with a blank space for it to search for occurrences and divide this text into parts: Vbnet Imports System Module Program Sub Main(args As String()) Dim…
-
1
votes1
answer43
viewsA: How to change some attributes of an object with Hooks
Need to do a breakdown of the current value and as the given example is a array of object with a position it is necessary to position in that position and also to do the destructuring…
-
1
votes2
answers43
viewsA: Select a specific JSON array with Javascript
Use the method find and create an expression that checks the item that satisfies the search as described in your question, example: const data = [{ FieldId: 8095, FieldName: 'Nome1', FieldValueIds:…
-
2
votes2
answers54
viewsA: Map array and include ID items using MAP and FILTER
The code is very basic, make a map to create a new array and in every passage within the map utilize filter on the other array searching for the information according to the filter and pass the…
-
1
votes2
answers57
viewsA: How to make two queries using the same Mysqlconnection?
You should use the same connection, it is not a good business to keep opening several connections to the same situation, so a minimal example, but, with rescues: What would be: listaClientes,…
-
1
votes1
answer36
viewsA: how to use DATA_FORMAT() in mysql with C# Asp.net?
To format information of any format and in the case for Date (day, month and year) exists in this same method Eval an overload where such an expected format can be made {0:dd/MM/yyyy} as shown in…
-
1
votes1
answer39
viewsA: Error importing multiple XML files - Codeigniter PHP
A minimum example of how to get information from a field <input type="file"/> with PHP: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta…
-
1
votes1
answer31
viewsA: Limit in Laravel 7
In the documentation in part Limit & Offset has two ways to do this search for parts of records starting from a position: Example: $users = DB::table('users')->skip(10)->take(5)->get();…
-
0
votes1
answer648
viewsA: Get a zip code?
Problems: When using the fetch need to specify its mode of operation that in your case and { mode: 'cors' } this object being the second parameter when the request verb is GET. Another point is that…
-
1
votes2
answers175
viewsA: How to import local sources via Vue/Vue-cli?
How are your folders configured? You have put the fonts inside the folder src? These are questions to be asked, so to set up a local font follow the following steps: Create a folder inside the…
-
0
votes1
answer67
viewsA: Creating condition inside the javascript map function
A minimal example where you first search for the object’s key to then associate its value or null for a particular key: const isExist = (obj, name) => { return Object.keys(obj).includes(name); }…
-
2
votes1
answer30
viewsA: Query returning users who have a set of records from another table
To sql expected is the following make a grouping in the table of cursos and according to the number of parameters that in the case are 3 (5, 7 e 10) check which of these returns is equal to 3 and…
-
2
votes1
answer40
viewsA: Why doesn’t my code make anything appear on the page?
Has some coding errors, a clear example of error: document.createElement(h1); i.e., to create the element is between quotation marks (or h1 is a variable in the text type code containing const h1 =…
-
1
votes1
answer103
viewsA: How to run a Javascript function after loading the DOM using React Hooks?
From what I could understand, it is necessary to execute some function when the component is ready (charged), utilize useEffect with a array no position, this means execution after loading the…
-
1
votes1
answer36
viewsA: React - Selecting a Card on the Screen
An example has been simulated according to what you are developing that when you click the block turns green or black: const config = { width:100, height: 60, margin: 10, cursor: 'pointer' }; class…
-
0
votes1
answer39
viewsA: Save value I already selected in combobox
To change the status of select at the time of the selection handleChange need to re-mount the corresponding key from the calcario, example: class App extends React.Component { constructor(props) {…
-
1
votes1
answer65
viewsA: How to update GRUD status?
I generated a minimal example and it worked practically with your code, I made a change enviarCadastro that at the time of insertion and on return is identified if the statusreturn 201 that says the…
-
0
votes1
answer81
viewsA: How to read a file and save each line at a position of a vector in C#
Because it’s not working? Was declared a array of string, but, has not initialized the amount of positions that this array of string will, example of the declaration: string[] dados; // não foi…
-
0
votes2
answers62
viewsA: I need to place coordinates from Mongodb on a map with reactJS
In the method componentDidMount() make the following changes: componentDidMount() { api.get('/api/clientes.coordenada') .then(res => { const local = res.data; this.setState({ position: rest .data…
-
1
votes2
answers27
viewsA: c# Webbrowser How to call the onclick function?
You can directly invoke the script as follows: webBrowser1.Document.InvokeScript("ExecutarLance", new[] { "46368" }); I think this might give you a way to solve your problem.…
-
0
votes1
answer23
viewsA: Convert SQL to Laraval Eloquent 5
If your model eloquent is with the name Groups is basically: $select = 'groups.id as group_id, max(groups.name) as name,'; $select .= 'max(groups.created_at) as created_at,'; $select .=…
-
0
votes1
answer43
viewsA: Tag Img does not render image from local folder Assets
In React images should be imported when the file is local, a clear example: import img from './assets/BeTheHero.png'; and in the code part pass this variable <img src={img} /> and remember…
-
1
votes1
answer23
viewsA: Change font color for a Datagridview column
Basically you need to develop a routine that interacts about each row (Datagridviewrow) contained in the Datagridview and test the value of a given cell and with the result then test the value…
-
1
votes1
answer50
viewsA: lastInsertId returns 0 (zero)
The adopted way is that in each $this->conecta() has a new instance of the class PDO used to abstract connection to a database, after calling this method again to rescue the last id inserted is a…
-
0
votes1
answer99
viewsA: Check active React checkbox
Had some errors and data disconnected between the base information with those that were in the form and this is bad because, the data to be sent is different from the natural state of the component.…
-
2
votes2
answers25
viewsA: How to instantiate a class with predefined and immutable parameters C#
If you have a defined and immutable list use enum, example: public enum Genres { Acao, Plataforma, FPS, Aventura, Corrida } public enum Plataforms { PS4, PS5, XboxOne, XboxSeriesX } and finally:…
-
1
votes1
answer40
viewsA: How do I specify the consumption of an API in React?
When you want to work with state you need to create within the state the information so you want to organize, in your case you want to get the first position of the array then indicate [0] if it is…
-
0
votes1
answer43
viewsA: Reuse mysql connection function where
Well I have a code and I will share how I would do this execution planning of SQL that returns records or not, example: mysql-connection.js const mysql = require('mysql'); module.exports = {…
-
1
votes1
answer740
viewsA: How to receive query params in React with reatc-router-dom?
The documentation explains how this type of approach in its variables Query creating a Hook auxiliary as follows: import { useLocation } from "react-router-dom"; function useQuery() { return new…
-
2
votes1
answer44
viewsA: Access JSON values with PHP
Basically, after retrieving this information with Curl of php transform into array with json_decode and then pass the keys in sequence as described in layout of json, code example: <?php $url =…
-
1
votes1
answer20
viewsA: I am trying to map this object array but get: Typeerror: Cannot read Property 'map' of Undefined
It is missing to put the position of array, that is to say, purchaseData is a array and so should be passed as follows: purchaseData[0].items Complete code: const PurchaseListView = ({gtin,…