Most voted "react" questions
It is an open source Javascript library for creating user interfaces. It is maintained by Facebook, Instagram and a community of individual developers and other companies
Learn more…1,420 questions
Sort by count of
-
2
votes1
answer128
viewsMap 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…
-
2
votes1
answer87
viewsDoubt about the correct way to structure components - REACT
I’m new to React and I always get a flea behind my ear when I’m creating some components. After all, the right way to structure is like this <label>alo {nome}</label> or creating a const…
-
2
votes3
answers268
viewsHow to sort an array of Javascript objects through an object value
I’m wondering how I can organize an array of objects in Javascript through the creation date of the item that comes as a value in the object, follow an example: [ { ...valores, requestedCase: {…
-
2
votes1
answer2464
viewsHow to validate objects inside objects with Yup/formik?
I am using formik with Yup to handle my forms and need to validate two objects I have set in my initial formik values: initialValues: { company: { company_name: '', cnpj: '', fantasy_name: '',…
-
2
votes1
answer194
viewsI am unable to extract data from json - React-js
gentlemen(as). I am unable to extract a data to send to api. in the /cases path the api provides json data. useEffect(()=> { api.get('cases',{ }).then(response =>{ setcases(response.data) })…
-
2
votes1
answer675
viewsHow to capture Axios error Response data when user has no connection?
I am using the Third Party of axios to handle errors in requests. I am currently using this way: const api = axios.create({ baseURL: 'http://localhost:3333' }); api.interceptors.response.use(…
-
2
votes1
answer115
viewsMap to list products in React with dropdown, how to open specific dropdown of each product?
I’m using the map to make a list of products, until then quiet, but in the layout there is a dropdown where we will present more information of that item, until then quiet also. But my problem is…
-
2
votes3
answers905
viewsShare state React Hooks
I’m having trouble sharing states between components using React Hooks. Can someone give me a help? import React, { useState } from 'react' import Nav from './Nav' export default function Header(){…
-
2
votes1
answer1301
viewsValidating 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…
-
2
votes1
answer1589
viewsReact fetch() POST
I have a API (POST) in which I pass some parameter and it returns me results and the question is the following: I got a guy Dashboard where I have to take DIA data and MES data (using the same API,…
-
2
votes2
answers132
viewsHow to pass value between Functional Components using Navigation.navigate
I am trying to pass values from one Functional Component to another Functional Component with navigation.navigate, on the first screen the value is there, I can see it rendering it or on the…
-
2
votes1
answer2567
viewsHow to pass Information from a functional child component to a parent React?
I’m developing an application with React with Hooks and functional components, and I came across the following logic: I need to screen render the functional components, both with Forms arrays inside…
-
2
votes2
answers2446
viewsError code Parsing error: Unexpected token, expected ","?
I’m having a hard time with mine JavaScript, the given error is: ./src/components_basics/Aleatorio.jsx Line 5:56: Parsing error: Unexpected token, expected "," 3 | 4 | export default (props) => {…
-
2
votes1
answer85
viewsPass state between components without hierarchy
I’m making a whole app list, and I’d like to have the Edit button appear in the field where I add my new item. But the action of the button and the state are sibling components. Addtodo (as I pass…
-
2
votes2
answers91
viewsProblems traversing Javascript object
I am consuming an API and displaying data with React. The API returns the following Json: { "1": { "id": 1, "nome": "Outros", "abreviacao": "OUT", "escudos": { "60x60":…
-
2
votes2
answers170
viewsI want to generate 4 random values from an array. How can I do it?
I’m looking to generate 4 random values from an array. I’ve tried using Math.Random, but it’s in an infinite loop... import React, { useState, useEffect } from "react"; import api from…
-
2
votes1
answer58
viewsReact + typescript how to pull 1 function within a React component
export function BotaoMenuLink(props: Props) { return ( <> <div className=""> <a type="button" onClick={BotaoToggli} className="bg-blue-700 hover:bg-blue-800 h-10 w-10 rounded-full "…
-
2
votes1
answer141
viewsHow to Resolve Infinite Request Loop React.js?
En route GET that upload backend image on useState that this in a component of the React is making infinite request to my backend component code: import React,{useState,useEffect} from 'react'…
-
2
votes1
answer78
viewsHow to exclude an element from the array if an equal value already exists?
I am trying to store the ID of some accounts that have been selected by a checkbox, that is I will have an array of all accounts that are selected, but I need that when it is unchecked, delete their…
-
2
votes1
answer416
viewsState returning wrong/late value
The application: by clicking on a button, an event onClick is fired and a fetch There is an API that returns data in JSON is performed. Right after this data is transformed into an object, the…
-
2
votes0
answers80
viewsCORS error with Signalr using Usecredentials()
As it says in the title, I have a CORS problem with the Credentials using Signalr, the error returned is: Access to fetch at https://localhost:54083/notification/negotiate?negotiateVersion=1 from…
-
2
votes1
answer169
viewsBrowse array of React objects
I intend within my parent component to create a function that will scroll through all objects stored in the state of this same component, checking whether the given parameter is equal to the value…
-
2
votes1
answer740
viewsHow to receive query params in React with reatc-router-dom?
I’m making an App, using React with typescript and React-router-dom. But I’m having a hard time working with query params on routes. My initial goal was just to receive the token and email that…
-
2
votes0
answers482
viewsArgument of type 'Iaulasadicional[]' is not Assignable to Parameter of type 'string'
Opa, I have this problem in my code which I am not able to solve, follows below my code I hope you can help me!!! Stoned: "AulasAdicionais": [ { "Periodo": "1", "HorarioInicio":…
-
2
votes1
answer47
viewsSingle React "key" problem
I am trying to create a chess game using React. I am doing very well except for this mistake. This is my code: import "./style.css"; function App() { const squares = []; //squares order for (var…
-
2
votes1
answer96
viewsHow to change the color of an SVG dynamically with props in React?
I’m trying to change the color of an SVG through props, but I’m not getting it. My component Hexagon that in which I receive the color via props and check with a switch: function Hexagon({ size,…
-
2
votes0
answers101
viewsTypeerror: Cannot read Property 'findOne' of Undefined (strapi)
I am creating an eCommerce using Strapi, but I have a problem in one of the routes that makes the POST. Summarizing this route she opens a payment session, and for that I step one request.body with…
-
2
votes1
answer170
viewsProblem typing first parameter of React setState
Hello, I’m a little new to the typescript world and there’s something going on that I can’t explain why. I have the following state: const [estaExecutando, mudarExecucao] = useState(false); Step to…
-
2
votes1
answer73
viewsHow 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}…
javascript react react-hooks number-format react-domasked 3 years, 8 months ago Danúbio Vieira Lima 397 -
2
votes2
answers167
viewsReactjs Toggle onClick variable
I’m trying to come up with a logic of a toggle, which activates/disables a kind of filter, but now I need to implement a new functionality in it, it works like this, if I click on a category button,…
-
2
votes1
answer72
viewsHow to optimize rendering on functional components in React?
In my studies on React Native I’m bumping into rendering optimization on components, specifically on functional components. It is known that any change in status or props, the default component is…
-
2
votes2
answers48
viewsWhat is the difference between using forwardRef or another prop to pass the reference?
To documentation says reference forwarding is a technique to pass the ref of a parent component for a child, and gives examples with React.forwardRef. But what’s the difference between forwarding…
reactasked 3 years, 5 months ago Rafael Tavares 4,528 -
2
votes1
answer65
viewsWhat is it and why should I provide a "dependency array" for React’s Hooks?
Who has never forgotten to pass a "dependency" to the dependency array Hooks react? It’s an unfortunate burden that every person using React has to be aware of: passing the right dependency to the…
-
2
votes1
answer36
viewsIs React able to automatically remove eventListeners from Refs when the component is destroyed?
I have an input from a web components that to receive the value inputado, I must create a Ref for that input and add a eventListener, respectively: const nameInputRef = useRef(null) const [userName,…
-
2
votes1
answer61
viewsHow do I get a simple change of status from a chekbox in React?
Yes, rookie in React/Typescript. Before anyone tells me to go study the material, I would like to say that I looked at different approaches to this, with different points of view, but none clarified…
-
2
votes0
answers28
viewsAvoid unnecessary rendering in React Native with multiple Textinput
The question is this: I have basically a code like this (I can’t send the real code right now, I’m sending this "Pseudo-Code" so ignore syntax and standardization errors): const Componente = ()…
-
2
votes1
answer67
viewsEvent "onClick()" running alone
This function is inside a map and within it, executed {Idchecker} The item id. is a value that comes in Array, I need this id to delete the post the user created, so idValue that stores post…
-
2
votes1
answer49
viewsProblems invoking external Libs functions in React
I’m developing a website in React and I need to use an external Javascript lib (I don’t have his npm package), so I have a link to import on the site. At first I thought of importing it into HTML…
-
1
votes1
answer577
viewsReactjs and routes
The Reactjs framework comes with the idea of web components. Well, he doesn’t use MVC but what about routes? in a menu? how would I access my components correctly?
-
1
votes1
answer240
viewsCreate class with common material-ui and React Imports
I would like to create a common class in my application with React and material-ui. I have, for example, to create a series of elements with tables. Every time I use I have to import some libs. For…
reactasked 8 years, 11 months ago Emir Marques 3,586 -
1
votes0
answers43
viewsHow to install and configure Markdown in Meteor together with React?
I’m learning React along with Meteor, so I saw in the official React documentation the use of Markdown is a good practice against XSS. I downloaded it in the media with "Meteor add markdown" but…
-
1
votes1
answer46
viewsProblem with HTML content presentation using this.props.Children with ngReact
I’m trying to present the content I inject into an Angular directive within an React component. See below for the call to the component: <alert type="'danger'">…
-
1
votes1
answer115
viewsHow do I share a property with other components in React?
Hi, I’m new to React and I have a question about property sharing. For example, I want to have a parent component that will have a property "Visible", and I want to share it with all my child…
-
1
votes1
answer1641
viewsTake Geolocation Coordinates (Reactjs)
Hello, I am developing a simple application that takes the geographical coordinates of the google maps api. It’s working, but I’m not getting the values that are in the other function. Actually I…
-
1
votes0
answers138
viewsHow to import an external React component to Asp.Net
Hello, I wanted to import a webpack generated React external component (Bundle.js) into my Asp.net MVC application. I am trying to import the "Bundle.js" file to my page and process the React…
-
1
votes0
answers89
viewssubscriberView Too slow or caught React-Native-opentok
I am using callstakio’s React-Native-opentok, when using only Subscriber it works normal, but when used Subscriber+Publisher Subscriber does not work properly. render() { return ( <View>…
-
1
votes2
answers781
viewsSlow reaction when opening graphical dependencies
After executing the commands: react-native init AwesomeProject cd AwesomeProject react-native start cmd, I cannot run the graphic part of Reactuy-Android Already have Android installed How can I…
-
1
votes1
answer103
viewsReactive Native error when generating Android app
I’m running the commands: react-native init AwesomeProject cd AwesomeProject react-native start And then that command: react-native run-android The error that appears: How to correct this error ??…
-
1
votes1
answer276
viewsError webpack with bootstrap-Loader
I’m having trouble implementing the bootstrap-Loader in the webpack. I get this error output on the console: ERROR in . /~/css-Loader!. /~/resolve-url-Loader!. /~/Sass-Loader? sourceMap!.…
-
1
votes1
answer358
viewsReactjs running in apache
I have the following structure to display the famous Hello World with reactjs: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script…