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
-
4
votes1
answer58
viewsHow do I make Typescript accept the "useRef" value in React?
export const Test = (): JSX.Element => { const wrapperRef = useRef(null); useEffect(() => { function handleClickOutside(event: MouseEvent) { if (wrapperRef.current &&…
-
3
votes1
answer744
viewsHow to organize my project?
I’m starting to learn react Activate and I am very doubtful about how to structure my project. I am creating an old game, which has the following configuration: As you can see, each of the…
reactasked 8 years, 7 months ago Jesley Cáceres Marcelino 31 -
3
votes1
answer2569
viewsGet Response from an API that returns error 500
Next, I have an API that returns error 500 every time it violates the business rule by returning me a status and a message. We know it’s not good practice to return status 500 under these…
-
3
votes3
answers896
viewsWebpack not updating Bundle.js
I’m new to this React and Webpack thing, and I’m studying a lot, but I’ve come up with a problem that I’m not finding a way to solve. const webpack = require('webpack') module.exports = { entry:…
-
3
votes1
answer4193
viewsReact Input Mask how to put the ninth digit?
I downloaded the package npm i React-text-Mask --save did the import in my Contact file but by default it comes out like this (55) 5555-5555 I’m having trouble putting this standard (55) 5 5555-5555…
-
3
votes2
answers357
viewsUpdate key in state when another key is updated
The main idea is based on a shopping cart, when a product is added to the cart (key products) the key orderTotal is updated. Inside the key products own a object with various products each…
-
3
votes1
answer626
viewsHow to pass a JSON object to another function?
In the 'componentDidMount' function of REACT I get the json of a link in question, but in the 'render' I cannot pass these objects because the object is in a '.then' in the first function. How can I…
reactasked 7 years ago Henrique Hermes 343 -
3
votes1
answer764
viewsAdd Scroll Bar to a Box
I am doubtful in my code, in it I will add a chat field, and in this chat the box should have a maximum size, and if in the case when adding the messages exceeds this value, it should create a…
-
3
votes1
answer361
viewsUse of routes at the frontend or backend
In relation to routing, it is more appropriate for routing to be on front and the same make requests to the server through AJAX, or the routing stay in the back and render the same views of front?…
-
3
votes1
answer168
viewsAccess token storages (JWT token)
I am facing the need to store the access token of a user who logged in through a method with Oauth2, this JWT token will be used for my frontend application, written in React, make calls to an API…
-
3
votes2
answers784
viewsProblem accessing Json API with React
I am trying to access the following variable in the Json of an API: page[0].infoBloco[0].tabela[0].dados[0].fonte.nome I’m getting the bug: TypeError: this.state.page[0] is undefined[Learn More]…
-
3
votes1
answer885
viewsHow to change the state of complex objects in React?
have the following object: obj = { title: "obj1", tab: [{ title: "titulo da tab 1", card: [{ title: "card1", url: "url", image: "image" }, { title: "card2", url: "url", image: "image" }] }, { title:…
-
3
votes1
answer121
viewsWhat is the difference between function statements (React)?
I am learning Act and came across this example (Which works normally): import React, { Component } from 'react' import './Teste.css'; class Teste extends Component { constructor(props) {…
-
3
votes1
answer142
viewsForm with list in React
I’m on my first project with React, and I’m totally lost with a. My form must submit customer data, and within that same form I can have two addresses. Since both addresses have the same attributes,…
-
3
votes1
answer316
viewsError trying to access an object property in an React component
I’m having a problem accessing information from an array that has an object inside, using React. This is the function that brings my json and changes the state of the application, it creates a…
-
3
votes1
answer65
viewsWhy is my route in React /#/?
I created a route structure with Hashrouter in React and everything works fine, but my route always http://localhost:3000/#/ + a rota. return ( <div> <HashRouter> <Switch>…
-
3
votes1
answer27
viewsFormattednumber of the Intl-React swap semicolon
Hello folks in my code is as follows const currencyFormatter = (value: string | number | ReactText[]) => { return ( <FormattedNumber value={Number(value)} style='currency' currency='BRL'…
-
3
votes1
answer439
viewsHow to post in XML in Reacjs
I am starting my walk in Reactjs, and I am going through a problem a few days ago, which is to login to an external api in my application, to give the user access to the rest of the application. I…
-
3
votes2
answers19646
viewsHow to redirect to a route using onClick and React Router
I have a screen (in React.js) called Cadastro.js. In it I have a form and the button register By clicking this button, I wanted you to direct to the login screen, which is the Login.js. How do I do…
-
3
votes2
answers92
viewsHow does React dependency/library management work?
Hey, you guys How does React dependency/library management work? Do you have a page in the documentation that talks about? Importing a library that has, for the most part, things that I won’t use…
reactasked 5 years, 8 months ago Joaldino Neto 31 -
3
votes2
answers338
viewsProblem with React and Redux
Hi... I’m studying React and now Redux. I’m trying to make a simple example: Where I have an input and button, I want to enter a value in the input and when clicking the button take the value and…
-
3
votes1
answer14667
viewsREACT-JS - Warning: Each Child in a list should have a Unique "key" prop
Problem in rendering my state always gives error: Warning: Each Child in a list should have a Unique "key" prop. Check the render method of Main. See https://fb.me/react-warning-keys for more…
-
3
votes1
answer68
viewsCreate a <div> inside a . catch in Aces
Hello, I am currently developing in React and am trying to put a div inside the .catch. I am currently using the following code: componentDidMount() { axios.get(API_ListaEmpresa) .then(response…
-
3
votes1
answer370
viewsHow to validate an array if it has objects inside it or not? React JS
I have a code made using React JS and it works like this, I have a select component, and this is reused several times and the information it receives always comes from an array, only now I need to…
-
3
votes0
answers38
viewsSymfony/React Solving Problems with Babel
I’m new to Symfony/React and soon I come across the following problem... I cannot execute the same commands that I find in some tutorials (Destined to React) on the Web, so I understood the "plugin"…
-
3
votes1
answer46
viewsProptypes always gives error no matter if the value is correct
I’m using the React (16.11.0) with Proptypes (15.7.2) and Hooks. And I have a component that receives an object with some data from the database. Testing the data using the console.log: {…
-
3
votes2
answers201
viewsReact Switch Route Default
I’m creating an app in Nodejs, React & Redux here at the company. And I have a page that is Content, in it I have two navigation bars and a common area for content. In this common area I’m using…
-
3
votes1
answer283
viewsWhat’s the difference between using a div and React.Fragment?
I am studying React more in depth and in one of the courses I am following is cited the use of <React.Fragment> to render multiple elements at once. Normally in my components I use a…
-
3
votes1
answer459
viewsHow to put objects in empty array with React Hooks
I have the following data set: const dados = [5, 10, 15, 20, 25, 50, 90]; const colors = [ "#52DF9A", "#FFCE1C", "#3570BD", "#3570BD", "#00B894", "#FB6B32", ]; And I’ve got the following state:…
-
3
votes2
answers196
viewsonClick error in Nextjs / React js
On the first tag <Link> is making a mistake in the onClick and I don’t understand why. Please help me out: import Link from 'next/link'; import React, { useState } from 'react'; export default…
-
3
votes1
answer685
viewsHow to get the url parameter in Nextjs
Guys, I have a question on Next JS, I have a page with name listid.js, when accessing for example http://localhost:3000/listid/10 I would like to receive id 10 as parameter on my page listid.js:…
-
3
votes1
answer167
viewsHow to use setTimeout to show a component only after a certain time with React?
I want a certain component to appear on the screen after 1 second. You can do this using JSX block? When I put the code below, a number appears on the screen instead of the message. function App() {…
-
3
votes0
answers48
viewsProblems with formData in Multiple Upload Express and Multer
I’m having trouble uploading multiple images to the backend. The method in the backend is correct, when I test via insominia the right one, however from my front it does not generate the data…
-
3
votes1
answer37
viewsWhat’s the difference between using one or two Arrow Functions in Useeffect?
In this reply from Soen, one uses a useEffect with two Arrow functions followed. Thus: useEffect(() => () => { window.removeEventListener('resize', compareSize); }, []); I wonder why the duo…
-
2
votes1
answer598
viewsSearch last firebase record and incrementing in new record
I need to fetch the last code in an array of objects in the firebase. Then increment +1 on that last code and then save the list with the objects. For now I created a generic DAO: //Dao generico…
-
2
votes1
answer99
viewsHow to resolve this error with the Materialui Drawer component
I am trying to use the Drawer of the ui material, but is returning the following error when Gulp will process it: Unexpected token (15:17) handleToggle = () => this.setState({open: !…
reactasked 8 years, 4 months ago Juliano Bailão 33 -
2
votes1
answer118
viewsReact.js Failure Manipulating Events
I’m starting to learn React.js by watching some videos, tutorials and documentation. However, I am having a problem with my code in Google Chrome appears like this: And in Firefox neither appears…
-
2
votes1
answer3545
viewsDestroy React Component (Unmounting Component)
I would like to know how to destroy a component with React by clicking a button. I found a way out, but in my conception it is quite "gambiarrosa". I have a state called show and when click on close…
-
2
votes1
answer209
viewsReact-Enable error after installing lib React-Native-router-Flux
After installing the lib React-Native-router-Flux in my app appeared this error on: I did the procedure of removing the folder…
-
2
votes1
answer114
viewsRiding . eslintrc, how to write?
I took a project with this Eslint: { "extends": [ "keystone" ], "rules": { "no-unused-vars": [2, {"vars": "all", "args": "after-used"}], }, } Another with that Eslint here { "parser":…
-
2
votes2
answers68
viewsDoubt of navigation
I created an RN project and within it I created a folder called screens. Inside the folder screens created the files app.js and home.js on index.android.js I only gave one: import App from…
-
2
votes1
answer756
viewsReact.js Error trying to access nested Json data via component state
I’m starting with React.js and am having trouble accessing data nested in a JSON. I’m using the whatwg-fetch to make the request and it’s working, but I can’t access the nested JSON data, example:…
-
2
votes1
answer174
viewsReact class constructor error
I have the following error when I try to use Component in this way. client?cd17:119 ./src/App/Components/AddNote.js Module build failed: SyntaxError: super() outside of class constructor (9:4) 7 |…
-
2
votes2
answers990
viewsI can’t change the default React app
I made some changes to the file index.android.js and saved, when running command React-Native run-android, the app remains the same!! The code is like this: var React = require('react'); var Text =…
-
2
votes1
answer468
viewsThe action takes an attribute from the class component but does not enter the Reducer-React
I’m doing a simple project with React and Redux to train and pick up an attribute (string) that is in the store through a component function I do a processing in this string and send to action that…
-
2
votes2
answers284
viewsError trying to install Flux Router
I came across a very annoying error when trying to install Flux Router in my app6 folder some suggestion: Note: I’ve already installed two libraries: npm install --save Eslint-config-rallycoding npm…
-
2
votes1
answer298
viewsHow to isolate CSS from a component?
I am using the React.js (in the example create React app) and I even created two components, but I could not isolate the .css of each component. The css of the tableInfo.css ends up being applied to…
-
2
votes1
answer226
viewsMake React components available as dependency
blz? i have some React components here and need to make all of them available in one dependency only, semantic style, how can I do this? i am trying to export the components on an index importing…
-
2
votes0
answers513
viewsHow to run webpack + Reactjs without Node.js in the client-side?
It is possible to run the webpack transpilator in the client-side without installing and running it on a Node.js server ? I am currently trying to implement a SPA application using React 15.1.0…
-
2
votes1
answer144
viewsHow to display an element from a true or false within the Object? Javascript Reactjs
i have an array of objects, and I want to display the value from their status which is an attribute within the object. this.state = { objetcs: [{ value: 1, status: false }, { value: 2, status: true…