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
-
1
votes1
answer25
viewsWhat 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
votes2
answers86
viewsproblems with this in Reactjs
The problem is this: I’m trying to build an accountant to practice mine React and an error occurred: this is undefined I created a state to hold the minutes and seconds: constructor(props) {…
-
1
votes1
answer1034
viewsWhen using history.push() my component does not render, you need to re-load the page to render
I’m using React-router-dom to work with routes in an React application. I have a file called Approuter.js that has my routes: const AppRouter = props => { const loading = useSelector(state =>…
-
1
votes1
answer32
viewsTable is not rendered again after a setState
I have a table of Material React Ui and I’m trying to accomplish sort in the data. After the array is sorted, my table is not being rendered with the new positions set by sort. I already checked the…
-
1
votes1
answer241
viewsYup: How to make a conditional rule?
I’m trying to make a conditional rule with Yup, but following the steps of the documentation, I get this mistake: Typeerror: ref must be a string, got: true if (typeof key !== 'string') throw new…
-
1
votes1
answer396
viewsReact does not render the result of this code
I am studying React and I have a problem, more precisely in the state part, where my code does not render on the screen. In this case I have a h1 and a ul and none of them appear on the screen, but…
-
1
votes0
answers31
viewsDoubt about the Redux-React store
I have three rooms: import { combineReducers } from 'redux'; import formularios from './formReducer'; import userLogin from './userReducer'; import errorReducer from './errorReducer'; export default…
-
1
votes1
answer71
viewsInput does not accept text - React
I’m new to React, but I don’t think it’s anything like React. I am sending a form to send and register in my database in the input fields as shown in the codes below, however, on the screen it does…
-
1
votes2
answers83
viewsBest Pattern to manage React component status with Hooks
Hello, everybody I’m starting with Reactjs Could someone ask a question, please? I was introduced to the two ways of creating components (of classes and functions), and chose to use ALWAYS functions…
-
1
votes1
answer282
viewsUse React components methods on Hooks
Next people, I have a flat list in my React Native app, where in it I need to use a "ref" to access her "scrollToEnd()" method, but how I’m using Hooks I can’t use the ref. Here’s an example of what…
-
1
votes1
answer40
viewsCombine two or more types and tuples in Typescript
In the section below, I have the following types: // eg.: type ButtonTypeModifiers = 'is-primary' | 'is-secondary' type ButtonMarginModifiers = 'has-margin' | 'has-no-margin' |…
-
1
votes2
answers74
viewsI cannot use a value saved in the state of React
I created a button that receives a value, by clicking on it the value is stored in the state, soon after I try to get that state value but empty lap, the interesting thing is that in the second…
-
1
votes1
answer223
viewsChange states between parent and child components with modal
I have a component that I need to control when the modal will open/close, where the parent component is the component that will open the modal and the child component (which is the modal) will…
reactasked 4 years, 7 months ago veroneseComS 2,752 -
1
votes1
answer583
viewsReact-router <Redirect> does not work
I’m doing an application in React and I want to make a check, if the guy is authenticated, redirect directly to Home, if not, goes to the Login screen, this is the Code: userReducer.js const…
-
1
votes1
answer516
viewsRight alignment with Styled Components
I need to align the yellow content to the right of my menu bar as follows: But when trying, align, the content is glued to the menus: The layout of my elements and my CSS are as follows: return (…
-
1
votes1
answer82
viewsWhat is the best practice in using Redux for small projects?
Good night. I am starting a project in Reactjs an ERP Web containing basic registrations of people, products, orders. I will use Redux for the benefits of state sharing between the components, but…
-
1
votes1
answer50
viewsReact/Redux - Function connection
Hello! I have a file containing a single function, it should return a boleano from a condition using the data from the Redux Storage. I can connect the file without being a Reactcomponent to Redux?…
-
1
votes1
answer71
viewsHow do I get a function within a functional component to pick up the props of that component?
I’m starting the study in React and am like a difficulty in this component, I want to pass the props that the component Todo receives to the handleAdd function, being that at the moment this this…
-
1
votes1
answer2110
viewsI can’t create a project with create-React-app
I can no longer create apps with create-React-app, I have already created some projects using create-React-app, but now it has stopped working. I run the following command to create an application:…
-
1
votes0
answers80
viewsRedux Hooks Reactjs - Trying to create a structure
I’m trying to create a login structure using Redux and Hooks in React.js. But I’m having an error that I’m not being able to understand why. Who knows good Javascript can help me. The reference…
-
1
votes0
answers75
viewsInclude state in a component instance (React Native)
I have the following problem trying to change the state of my Modalchat component: ExceptionsManager.js:82 Warning: Can't call setState on a component that is not yet mounted. This is a no-op, but…
-
1
votes2
answers505
viewsHow to increment a state object with another object in React Native?
Basically I have this method that takes some information from the API and stores it in a state variable (date: []), but since there are several pages, I would like to add the results in this…
-
1
votes1
answer1119
viewsJWT Token Refresh
I have an API that issues a JWT token with a maximum validity of 2h per token, after which it is no longer processed by my application. I need that every time this token is expired, a new token is…
-
1
votes2
answers84
viewsNestle 2 maps and write data inside each of them in the React
I need help to write a map on a page in React, but inside this map there will be another map, so before arriving at this second map it must render a data from the first map, the current code is like…
-
1
votes1
answer702
viewsNodejs + Mysql + Return of Database Queries
Good afternoon! I’m having some problems with NODEJS using a Mysql database, I’ve made several attempts and I’m not sure how to solve this problem. My problem is that I would like to consume the…
-
1
votes1
answer199
viewsReturn key and value pair using a map
Hello, I am trying to return a key and value pair using the function map(), however I am passing the information to my component via props, my component receives a text and a value inside it and…
-
1
votes2
answers835
views -
1
votes1
answer332
viewsReact with Hooks, useState, the value sends to each input and does not show on the screen.?
I’m doing a compound interest calculation. I receive the form data valores.js, called by function enviarValores() with the onSubmit={handleSubmit(enviarValores)} and I want to send the answers…
-
1
votes1
answer728
viewsModal in React JS
Good morning, you guys! I have a form, on the button to save the data of the same I call a modal component asking if the user really wants to perform the operation. The question is: I don’t know how…
reactasked 4 years, 5 months ago Sena Oliveira 364 -
1
votes1
answer178
viewsHow to import a css file within JSX by link tag or script (React)
Hello, I’m learning React, I saw some basic concepts in a micro-course on youtube, and to train I would like to turn a site I already have into html and bootstrap for React. One of the problems I…
-
1
votes3
answers1423
viewsuseState does not update - Reactjs
I’m starting in the world of Reactjs. I have a front that is consuming a tracking API, so it returns me an object with status, responseMessage and Object, an array of objects. I do the…
-
1
votes1
answer162
viewsHow to edit the CSS of an image Link made by <a>
Wanted to round the edges of an image she was made with the tag <a> HTML, but I’m totally lost. This is the code I used to import the image: <a className="imagepost" href={post}> <img…
-
1
votes1
answer295
viewsHow to change a state of a Component in React navigation
I need to change a state within a function of React navigation, this state will change a behavior in the Component function TabOneNavigator({navigation}) { React.useEffect(() => { const…
-
1
votes1
answer25
viewsHow to exchange the value of Select - Materil UI
Hi, would you like to know how to set a value in Select Component, Material UI, through a click? For example, by clicking the button, invoke the handleAlert function, which changes the Select value;…
-
1
votes1
answer37
viewsHow to set constant value
I’m using the React-Dropzone package to upload imgages Now I would like after loading the data from the server, I would like to set an image that came from the data search in the React-Dropzone How…
-
1
votes1
answer1070
views(Reactjs) Hide div by clicking button
I have the following code in React: import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import './Join.css'; const Join = () => { const [name, setName] =…
-
1
votes3
answers1189
viewsHow to structure React Js folders and files?
I’m starting to learn React Js and I’m intending to create a website on it, but I was left with a question. The React Js is the component base, right? I have the App.js where I call my own…
-
1
votes1
answer41
viewsHow to reuse a React component by displaying it differently?
I have a component called Header and wish to reuse it in a few more pages. When I do the import Header from './Header' and call him on the page desired, it’s all right. What I wish is to bring the…
reactasked 4 years, 3 months ago Sena Oliveira 364 -
1
votes1
answer729
viewsHow to call a Function from another file, within a Function from the main file?
I have in the file App.js And the first time it’s loaded, it calls the const response = await api.get('/searchDate');, and returns a list of dates. I want to take the first position on the list,…
reactasked 4 years, 3 months ago Rebeca Nonato 1,163 -
1
votes1
answer43
viewsDiv in React is not appearing
I am having a problem in trying to clone the front of the trello and the problem begins to occur when I try to insert the columns. I have a date that stores the column and ticket data. With tickets…
-
1
votes1
answer201
viewsWhy doesn’t React accept camelCase to name components?
I was preparing a component whose only function was to export a tag <p> containing a text. I naturally created a function that exported the text: import React from 'react'; function…
-
1
votes1
answer3465
viewsWorking with environment variables in Reactjs
Hello! I’m starting now with Reacjs. Usually in Nodejs I create a folder environments and put the index.ts or index.example.ts, with values there DB=nome_banco HOST=localhost USER=username When I…
-
1
votes1
answer57
viewsError in useEffect accessing API data
I have the following hook that runs the API calls smoothly, returning the information and updating the components normally, but it brings some connection errors in the console, I believe these…
-
1
votes2
answers249
viewsInput component is not changing the state value
I have an Input component that is a Textinput Wrapper (React-Native). When I type the value in my Input component and then try to show the value of the variable to which the text should have been…
-
1
votes2
answers362
viewsuseState does not work as expected
I want to do a simple mathematical operation from two random numbers when I click on the button, however, every time I click on the button the result shown on screen is from the previous operation…
-
1
votes1
answer747
viewsSearch filter with React
I am studying Javascript and need to do a data filtering based on what the person type and delete in input dynamically. I searched and could not implement in my code, I am using the useEffect() to…
-
1
votes1
answer524
viewsIntegrating Google Maps with React JS
Personal talk, I’m having trouble integrating Google maps into React. I saw many people with this doubt, although the documentation of the api is quite complete, most of the examples I saw are…
-
1
votes1
answer110
viewsHow do I direct the link to the anchor and close the modal at the same time?
I have some links in a modal made in React that go to anchors of the page that the modal was opened. I am using href for the anchor and the onClick event to close the modal. Example: <a…
-
1
votes2
answers365
viewsHow to render asynchronous content in React Native?
I’m new to React Native and I’m developing a test application where I need to save some data on the device using Async Storage. I was able to save the data correctly, but when I try to get the data…
-
1
votes1
answer417
viewsInfinite loop with useEffect and useCallback
As code below, I need to call a function whenever inView is true, but using useEffect and useCallback listing the dependencies, I cause an infinite loop. The only ways I could avoid were without…