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
answer191
viewsAxios returning HTML data, not JSON
I am developing small project to learn Act and I came across the following problem. When making a request in an Axios API by passing input as parameter to the route, Axios is returning an HTML, not…
-
1
votes1
answer50
viewsJSX element does not load using this.state.list.map
I’m making a Forms in React and I need that after sending the form the same be rendered in a div different showing the content to the user However the component Showforms is not rendered and much…
-
1
votes1
answer29
viewsHow do Textinput print number 1 every time you press Buttom?
How to do the TextInput print out the number 1 every time we press the button? Example: if I press 5 times the button, I want "11111" to appear on TextInput. const App = () => { const state={…
-
1
votes1
answer69
viewsHow to change state of an object attribute with React Hooks
I have the following status with React Hooks: const [active, setActive] = useState({ card1: false, card2: false, card3: false, card4: false, card5: false, card6: false, card7: false, }); I would…
-
1
votes2
answers511
viewsUsing React, Typescript and Nodejs. Sending form for JSON user registration. I only know how to use Formdata. How to pass the elements as JSON?
Frontend import React, { useState, FormEvent } from 'react'; import { Link, useHistory } from 'react-router-dom'; import Header from '../../components/header/header' import './register.css' import…
-
1
votes0
answers16
viewsReact-onesignal does not return playerID
Hello, I am trying to return the user’s unique browser ID to save that ID after notification permission is granted by the user in the browser. I am using the lib React-onesignal and when I ask for…
-
1
votes1
answer213
viewsHow to toggle the status of only one item in Flatlist?
I have the following code: const Sounds: React.FC = () => { const [hasSelect, setHasSelect] = useState(false); return ( <Container> <FlatList data={data} keyExtractor={item =>…
-
1
votes1
answer26
viewsI’m not getting the Json data - React Native
I am unable to extract the data from the api. Here I get the data: fetch(config.baseURL + '/calendario/situacao_horarios_mes/TESTE/2020/12') .then(res => res.json()) .then(resJson => {…
-
1
votes1
answer85
viewsShould I avoid using "optional chaining" within the dependencies of a Hook?
Today I noticed that I use the optional chaining (?.) within the dependencies of a hook: useEffect(() => { // ... }, [route.params?.addedProduct]); It seems to work as expected, at least for now…
-
1
votes0
answers86
viewsHow to apply context api with good practices?
I am studying React.js and to fix the contents I am developing an application (SPA), the case is that I found the code barely readable even after applying the context api to solve the prop Drilling.…
-
1
votes1
answer77
viewsOrganize table with reactjs and firebase
I am receiving data from Firebase with Reactjs and my problem is that I want to organize this data in the table as follows: But I can’t do it, that’s the result I got: I know it is a relatively…
-
1
votes0
answers54
viewsDoubt Fetch + React Native
beauty? I am developing an App with Expo for a client, but when I consult (via barcode) its API, always the first time returns an empty Array, if I do the query then the data is returned. Can you…
-
1
votes0
answers69
viewsTouchableopacity problem, negative margin and Android - React Native
I have a problem with TouchableOpacity using negative margin so that different TouchableOpacities stay a little on top of each other (I’ll post an image to better understand). These buttons are…
-
1
votes1
answer74
viewsCors error in application dotnet core + React web app
I have an application problem that when I send files via POST and the image is larger in Mb Cors error occurs, images of a few kb work normally. Dotnet core api In the api I already added Cors and…
-
1
votes1
answer253
viewsIs it correct to use useCallback within a custom hook?
I’m having trouble using custom Hooks inside the useEffect, in particular, when defining within the useEffect custom hook methods that alter your internal state. Faced with this problem I came…
-
1
votes1
answer893
viewsHow to create private routes with nextJs
Hello, I would like a help for creating private routes using Nextjs. All files deposited inside the directory pages become accessible routes, in my application some of these must be accessible when…
-
1
votes3
answers127
viewsHow to call React routes with Nodejs?
I’m deploying a project that has Front in React and Back in Nodejs, but my host (Kinghost) asks me to deploy the Node app and within the same folder put the React Build, the FTP looks like this:…
-
1
votes1
answer39
viewshow to select an Array within an api in React?
You guys talking? All right? I have a problem in my React application with an api, you could help me? I want to show the names of the Pokemons of an api, but the array that gets the names of the…
-
1
votes0
answers10
viewsReplacing Datepickerandroid and Timepickerandroid by Datetimepicker, but I can not use
I’m doing a project of a course I bought, but in a certain class is used the DatePickerAndroid and TimePickerAndroid, that have been discontinued (including Timepicker no more). The code was as…
-
1
votes1
answer146
viewsImport inline SVG from Absolute path in Next.JS
I’m having trouble setting up Next.Js to make imports on absolute camino. I set up the tsconfig.json using the baseUrl as "src" and even works except in inline SVG files. I am using the…
-
1
votes0
answers26
viewsReact Redux: How do I map two objects to each correctly rendered child component using mapStateToProps and mapDispatchToProps?
A child component is rendered by map in the parent component... Via props, in the child component, I receive two objects and I would like that data to be rendered in the right component that is…
-
1
votes0
answers21
viewsHow to manage the prop "disabled" of a multi step form buttons with Formik?
The Formik provides a call prop isValid, which already solves the problem of defining when the form button should be disabled. The problem is that this apparent does not work in a multi step form,…
-
1
votes0
answers33
viewslogin Passport with email and password and passing id user as parameter in get
I am creating a website in React, Nodejs and Mongodb for a course project and I have a question in my login. My login prompts email and password to the user, but I created my method on the front…
-
1
votes1
answer40
viewsHow do I specify the consumption of an API in React?
all right? I’m starting now in the world of React and I have this little problem in question. How do I specify the consumption of a specific Array with React? For example: "count": 1118, "next":…
-
1
votes1
answer46
viewsPrivate route does not check whether the user is logged in or not
Good morning, I am trying to check if the user is logged in or not, I have an endpoint that returns me a token, on the front I am taking this token and doing this check, the problem is that even…
-
1
votes2
answers520
views'webpack-dev-server' module not found
While trying to execute yarn webpack-dev-server --mode development the following error appears: $ C:\Users\Coding\code\frontend\node_modules\.bin\webpack-dev-server --mode development…
-
1
votes0
answers102
viewsNextjs Error occurred prerendering pages
Export encountered errors on following paths: /blogs/categorias/[slug] TypeError: Cannot read property '0' of undefined export const getStaticPaths = async () => { const res = await…
-
1
votes0
answers76
viewsBreak line by pressing Enter and Shift + Enter
I have an input, and I need it to break line by pressing Enter and Shift + Enter, and only send the message by clicking the button. But he doesn’t break the line handleChatInputPress = (e) => {…
-
1
votes1
answer34
viewsHow to insert a web snippet into a React js application
I need to insert a web-snippet provided by Delighted for NPS research. I know React works on the component issue, and it’s likely that importing a direct js script is bad practice. But finally, how…
-
1
votes1
answer67
viewsHow do I test integration with mock from React?
I want to test the following component but I don’t know how to use jest mocks in case of a request with Axios. Component: import React, { useEffect, useContext } from 'react' import {…
-
1
votes1
answer65
viewsHow to update GRUD status?
How do I update the status ? How do I click register and update the screen on time, and when to click X it delete and also update the page on time. I’m not getting, I have to give an update on the…
-
1
votes0
answers53
viewsReact and Redux, call with Dispatch to re-loop causing class-based component
My application combines React and Redux I have a class-based component called Login.js, a Slice called settingsSlice.js, and I’m using connect to access the state of that component. My files:…
-
1
votes1
answer38
viewsPOST method with 'res' returning value, but playing null on 'date'
I am trying to make a POST request in an API created in Springboot and when running the React application I get the date to have the desired value. But when will I pull the res.data it returns the…
-
1
votes1
answer714
viewsWebpack error (Yarn webpack-dev-server-mode Development)
I’m trying to create my first Reactjs application. When running on the bash terminal of Vscode the following command: yarn webpack-dev-server --mode development The following error appears: $ yarn…
-
1
votes1
answer44
viewsError in socket.io "expression cannot be called" in React/Next
I’m trying to make a Real Time Chat with socket.io with Next.js, but when it comes to importing and putting as constant is returning an error, I don’t understand because I’m about to make this code…
-
1
votes1
answer43
viewsWhy isn’t my function changing the background as expected?
I’m trying to change the transparency of mine header based on the scroll of the screen. To do so, I created a eventListener of scroll triggering the following function: function solidHeader(){ if…
-
1
votes1
answer144
viewsInserting data into failed Datagrid for unique ID not found React Material-UI
the error that presents me: Error: Material-UI: The data grid Component requires all Rows to have a Unique id Property. A Row was provided without id in the Rows prop: {} I build my table according…
-
1
votes1
answer37
viewsHow to create a test for a screen that uses the same hook multiple times? React Testing Library
I came across a test scenario in React where I need to hook twice. In this case I am using a hook called useGet() in two situations on the same page. Of all the times I have tried only the last…
-
1
votes1
answer120
viewsHow to make two Scrollview on the same screen in React Native
I have a screen with several frames fixed height, and within each frame I have an amount of items. I need a ScrollView on the whole screen to scroll the frames, but also need another ScrollView…
-
1
votes1
answer30
viewsControl inputs React
I have a component that renders a Material-ui Switch-style checkbox. The code is this: import styles from './styles.module.scss'; import { useState } from 'react'; import { handleInputsRelativeIds }…
-
1
votes1
answer28
viewsTextarea problem that I use inside a map using React
I don’t have much experience with reactjs, but I’m doing a project that uses this lib, using typescript as a language. The problem is this, even before I used a map to render the elements of an…
-
1
votes2
answers42
viewsuseEffect returning null
I’m starting with React Native, but I’m having trouble getting a list when loading the screen using useEffect, every time you start the screen the first time, setList returns empty, and when I click…
-
1
votes0
answers20
viewsTypeerror: clients.map is not a Function
I need to list some records, but is returning me an error: TypeError: clientes.map is not a function import React, { Component } from 'react'; import api from '../src/services/api'; class App…
-
1
votes1
answer41
viewsHow to include multiple texts in an array in the same function?
I’m trying to include in a array several messages that are in the same function. I receive some data and make some comparisons according to some requirements, resulting in a message that I need to…
-
1
votes1
answer36
viewsRoutes React React-router-dom
I’m starting at React and I’m trying to create internal navigation links. I’m wondering if I’m doing it the right way. created the Routes file import React from 'react' import {BrowserRouter,…
reactasked 3 years, 7 months ago user130331 -
1
votes0
answers19
viewsI’m trying to access the css values inside a variable but I’m not getting
I am using the code below but I cannot access the values of the variable cssPrimary and use other values together, someone could give me a help. I need that little help import styled, { css } from…
reactasked 3 years, 7 months ago Poly Ribeiro 11 -
1
votes1
answer96
viewsHow can I create a tab scheme with React Hooks?
I am creating a system, and instead of putting the 'sub-categories' of entries below the menu, I am creating as tabs, when you click on each menu and then have the other accesses. Example: by…
-
1
votes1
answer56
viewsReact JS Lifecycle Problem
Good night! I’m in the development of a page that has three buttons. The first button (Publications) renders this content: The second Button(Jorys) renders this second content: And the third…
-
1
votes1
answer50
viewsProblem rendering the Component that has a function in useEffect
I created in my project a "Slide show" component that has the function below to perform the automatic slide. However, when going to another page using the useHistory push function…
-
1
votes0
answers72
viewsReact-spring useTransitions Error no typescript
I’m having a problem, replicating a code I saw on the net, but he’s giving me a typo on Typescript. The code is exactly the same, but is returning me error in typing Props and I can’t seem to fix…