Posts by novic • 35,673 points
1,265 posts
-
1
votes1
answer702
viewsA: Nodejs + Mysql + Return of Database Queries
One model I use is the following connection.js: const mysql = require("mysql"); const connection = mysql.createConnection({ host: "localhost", port: "3306", database: "db", password: "senha", user:…
-
1
votes2
answers84
viewsA: Nestle 2 maps and write data inside each of them in the React
There is another way, stands as another example that is joining the returns, example: function App() { const students = [ { name: 'name A', evaluation: [ {grade: '1'}, {grade: '2'} ] }, { name:…
-
0
votes3
answers905
viewsA: Share state React Hooks
You’re looking to make one Prop Drilling which is basically pass props for their children and so on, example: function Children({open}) { return (<div>{open ? "Aberto": "Fechado"}</div>)…
-
1
votes1
answer43
viewsA: how to create a table to display an array
To generate a table with dynamic data a minimum example has been created: const arr = [ {soma: 100, categoria: "cat1"}, {soma: 200, categoria: "cat2"}, {soma: 300, categoria: "cat3"} ]; function…
-
0
votes1
answer150
viewsA: How to display a message in the view via a viewdata
Analyzing your code below: if (user == null) { ViewData["mensagem"] = "teste"; return RedirectToPage(); } is done in code one ViewData["messagem"] and then a redirect to the method OnGet from that…
-
0
votes1
answer366
viewsA: Background image with Styled-Components in React invalid path?
Your address is really wrong, the folder src (which means source) is your root folder, ie, get from that folder reading all the code and related files so that your app work, then change:…
-
0
votes2
answers505
viewsA: How to increment a state object with another object in React Native?
To gather information between two or more array in javascript may use the technique of dismantling (that makes it possible to extract data from arrays or objects in different variables), example:…
-
2
votes3
answers195
viewsA: Why do I need to spend two then on AJAX requests made with the fetch API?
The first then returns a promise(A Promise is an object that represents the eventual completion or failure of an asynchronous operation.) of the kind Response where is set by the developer which…
-
0
votes2
answers1493
viewsA: Change the entire color of a React tab
I don’t know exactly what your code does, but a simple example can help you solve the problem of color change on the page: function BodyPage() { const [color, setColor] = React.useState('black');…
-
1
votes2
answers1538
viewsA: Update useEffect from the navigation.goBack page?
The event should be created with useEffect but, the event is the navigation component installed in the project @react-navigation/native: 5.1.5, following the example code contained in documentation:…
-
2
votes1
answer26
viewsA: Search data via SQL using Laravel
In the paginate is the return on page (that is, page 1, page 2 and so according to the page have this result): $usuarios = User::where('nome', 'LIKE', $search. '%') ->paginate(); // isso retorna…
-
0
votes1
answer31
viewsA: What is the best way to send post to register together with the child elements?
Simply put in your class ClienteViewModel a field that will receive the collection of phones cited in your question public string[] Telefones { get; set; }: public class ClienteViewModel { public…
-
1
votes1
answer188
viewsA: My component within my modal is rendering twice
I’ll leave an example anyway, with the useEffect to render the component and after that update a local state variable to load the information thus not generating unnecessary rendering, example:…
-
4
votes2
answers107
viewsA: List Birthday Kids of the Day Using Laravel
As far as I can tell, you only want the day and the month of any date, so you can call the two corresponding methods whereDay whereMonth Example: $dataAtualCarbon = Carbon::now();…
-
2
votes1
answer105
viewsA: How to sync multiple buttons to an event?
Your code is correct, what is missing is to specify an event that at the time of the Click, can change component color, example: private void Form1_Load(object sender, EventArgs e) { char letra =…
-
1
votes1
answer56
viewsA: How to call a function within function?
@Virgilionovic needs to invoke the function findMovie inside getMovie, but the above code is not working. I believe the way I’m calling the function findMovie is incorrect By the user comment failed…
-
0
votes1
answer3173
viewsA: useState with array - React Native
You’re doing it wrong, you’re not passing on the options of array and yes by concatenating the text of the first item of array with a value 1, and has to make another state variable where this will…
-
1
votes1
answer838
viewsA: How to make a table where the cells are inputs in React with Material UI
If updating a array of values where the input(s) will have the initial state, is more or less like this (independent of Framework Css using), example: function App() { const [items, setItems] =…
-
1
votes1
answer2264
viewsA: How to change an icon within a React application?
It can be created a variable of local state of the component and when clicking on the icon the value is changed to appear the sun, in your code need then change this mechanism, an example outside of…
-
2
votes1
answer291
viewsA: React hook form checkbox always true
The variable that is returning from your bank is not in the format of true or phony (boolean), is a text, thus being true for the javascript, Example: function App() { const [value, setValue] =…
-
0
votes2
answers83
viewsA: Best Pattern to manage React component status with Hooks
Next, you make each state separate, if you have a list of values and have a value true/false are separate data, perhaps related, but, do separate for various reasons, one is organization, other…
-
1
votes1
answer194
viewsA: Return some query columns using LINQ
One can create a ViewModel with two fields (in your field id and nome) and when using ORM Entity Framework do the following: public class ViewModel { public int Id { get; set; } public string Nome {…
-
0
votes1
answer387
viewsA: Counter does not update data on the page using Reactjs and useState(), only when I place a console.log() can I see the result
We are not absolutely sure, but for his problem presented missed catch children of his props in the component <Header />, to render any functionality being these functions javascript, text and…
-
1
votes2
answers94
viewsA: Change State of Component called more than once
I would do in the component <Pai /> the value and event logic of upgrading so that it is shared by the component <Filho /> as an example below: function Filho({value, onClick}) { return…
-
10
votes3
answers598
viewsQ: What is the difference between keys and parentheses in an Arrow Function in Javascript?
What is the relevant difference between keys ({ }) and parentheses (( )) in a return of a function? const example = () => ( ... ); Versus: const example = () => { ... };…
-
0
votes1
answer37
viewsA: Use useEffect every time my Location.pathname is changed
The location.pathname is not a component state variable but, if you need that every time the component receives some change it recovers some value do not pass anything to the array of useEffect,…
-
2
votes2
answers227
viewsA: Extract data from JSON as an example
With map on the way json.convicts.rows, drawing only the value of idConvict new is generated array [7, 23], example: const json = { data: { act: "3 ", searchType: "2", searchData: "33014421" },…
-
2
votes1
answer299
viewsA: Why is fetch returning a file and not the data?
You are doing wrong, return example json fetch('./data.json') .then(response => { return response.json() }) .then(data => { // Work with JSON data here console.log(data) }) .catch(err => {…
-
2
votes1
answer62
viewsA: Create a Div Element dynamically in pure JS and assign a random Bg color to it
Lacked little, example: /// FUNÇÃO QUE GERA UMA COR ALEATÓRIA function getRandomColor() { let letters = "0123456789ABCDEF"; let color = "#"; for (var i = 0; i < 6; i++) { color +=…
javascriptanswered novic 35,673 -
1
votes4
answers62
viewsA: The display property exchange does not work with if em js
Your logic is not correct, so I decided to write a minimal example, where: I start images where only the first one will be visible. By clicking on the image check if it is already the last and if it…
-
0
votes2
answers63
viewsA: Hello, I’m trying to search the Laravel, who can help me
By commenting: I want to search the Record if the terms exist it returns the Record model, if it exists in the Item model Returns the Record relative to it. $ret =…
-
1
votes2
answers86
viewsA: problems with this in Reactjs
Because the mistake happened? How much do you work with classes in react, the methods in react need to say in what context it belongs and with bind(this) solves this problem. There are ways to solve…
-
2
votes1
answer126
viewsA: Insert Input value as a Select Option
I’ll focus on the part of adding an item to the list so that your select is updated with the new value, that is, its list that loads the select from the moment of its update automatically the…
-
0
votes1
answer347
viewsQ: Component in Reactjs re-rendering child components without need, how to get around this?
When a component Father consequently updates its Son(s) (s) also and(are) updated(s), without at least changing any value of its props and states, for example: function Filho({item}) {…
-
1
votes1
answer347
viewsA: Component in Reactjs re-rendering child components without need, how to get around this?
There is, with the React.memo (or in classes with Purecomponent that compares the state and props superficially, taking proper care of complex objects, that is, this feature are for components with…
-
1
votes1
answer25
viewsQ: What would the same code look like in Reactjs using Hook to rescue the start of component creation?
With the code just below I want to simulate the same effect with React Hook in the componentWillMount method contained in classes for reactjs? Example below with code: class Example extends…
-
1
votes1
answer25
viewsA: What would the same code look like in Reactjs using Hook to rescue the start of component creation?
To have the same effect use the useEffect with a array without any item, as an example below: function Example() { const [count, setCount] = React.useState(0); const handleIncrement = () =>…
-
0
votes1
answer212
viewsA: Private routes with reactjs?
I have the code this way, I realized that in your have a parentheses in place of the keys, it may be this, I’m just guessing, but, right below there is the code that I use and that works perfectly,…
-
1
votes2
answers50
viewsA: Trying to print the total sum of all values within the list?
In your question your code has enough problems one of them is to put the soma to print inside the for, at that time the variable soma should only receive the sum of the next item and the soma and…
javascriptanswered novic 35,673 -
0
votes1
answer153
viewsA: Reactjs Components - Button/rendering problem
A minimal example of how to change the component under some established condition, this may give a north how to do this and now it is with you put your own idea. class Home extends React.Component {…
-
1
votes1
answer302
viewsA: Placing items in an array with Reactjs
What’s going on is that your array is being updated right with the 3 positions created, but, does not show this in the console.log because the ReactJs did not update your component, for this to…
-
0
votes1
answer108
viewsA: One-To-One relationship with the same Entity Framework table
There’s a way this works out that’s a self relationship 1 for 1, I don’t know what your real goal is to do so, maybe there are better ways, but, I ended up doing a minimal example and it works,…
entity-frameworkanswered novic 35,673 -
1
votes1
answer42
viewsA: How to apply recursive functions?
Basically a recursive function is the one who invokes it until a certain condition satisfies, in the case of his question it seems that the exercise is to sweep the letter to its end, then a code…
-
1
votes1
answer231
viewsA: Upload image with Vue.js + . net core 3.0
Your code seems to have typo, because in sending is image and in the C# class is File, with all this I decided to do a minimal experiment that in part vuejs: updateGeneral() { let fd = new…
-
0
votes2
answers138
viewsA: I’m not being able to capture the various items selected in Lect2, how to do it?
Wrong configured component, not a common attribute, is a property with the name of SelectionMode where your configuration pattern is Single but, it needs to be Multiple so that the selection is…
-
1
votes1
answer370
viewsA: How to leave values already filled in the input (VUE Js)
To fill the value must use v-model for <form/> As follows create a template (model) and group their values, then in each input writes the field referring to the model and its respective key,…
-
2
votes1
answer136
viewsA: Entity Framework Core relationship creation one to Many
Did the wrong relationships, example, in class Evento belongs to a Venda, then your model lacks to explain this relation in the following way, follows example: public class Evento { public int Id {…
-
3
votes2
answers78
viewsA: Using Promise Javascript
You did wrong, first you need to check if the request was ok and after such verification use the promisse again to redeem the values, example: const elemento = document.getElementById("elemento");…
-
0
votes1
answer175
viewsA: Laravel 6 custom validation
As explained in the documentation in the item Customization of Messages Errors need to make the following settings as described in your question which in case is for a rest (if it’s form in place of…
-
0
votes3
answers1368
viewsA: Get Laravel login user address
In that question Save Relationship 1:1 on Laravel 5.3 already have a basic example of how to access the relationship and bring the data, maybe it is not the best way as you did {{…