Questions tagged [react-16]
92 questions
0
votes
1 answer
How to show a different div in react 16 when a boolean changes from false to true?
I have a basic form in a react 16 app. Upon successful submission of the form I am switching a variable from false to true and I then want to display a different div once the boolean is switched.
Here is my variable declaration and form submit…

reknirt
- 2,237
- 5
- 29
- 48
0
votes
0 answers
index.js:1 Warning: Received `true` for a non-boolean attribute `active`
Does someone can say me what caused this error and how to fix it?
I already tried to change active keyword but still got same warning.
Not sure if it's problem with Styled components or with just attributes.
Down is the error and code.
Actual…

turok87
- 81
- 1
- 10
0
votes
0 answers
When links are open in new tab from react application different information is shown on all tabs
I am stuck in a situation. I am creating a table component in which admin can see all the registered users like
I am using Mobx as store
Username email phone
abc abc@abc.com 000
bcd bcd@bcd.com 000
def…

Geetanshu Gulati
- 692
- 8
- 13
0
votes
1 answer
React: sharing a variable between functions in a same component
I have a function where I am supposed to pass file name so that it can reach next component but I have no idea how to achieve this in functional React. As of now I have a variable file which stores the filename returned from the API below
let file =…

Shivam Rai
- 21
- 4
0
votes
1 answer
JSON & REACT 16.8 TypeError: _data_projects_json__WEBPACK_IMPORTED_MODULE_2__.map is not a function
The error "TypeError: data_projects_json__WEBPACK_IMPORTED_MODULE_2_.map is not a function" is thrown when I try to complete the following map function.
import React from 'react';
import './Projects.scss'
import Data from…

Carolina Klein
- 81
- 1
- 2
- 10
0
votes
1 answer
react 16: Uncaught (in promise) Error: Unexpected token u in JSON at position 0 at A
Had this error appear in my app, so I just started a brand new React16 app with npx create-react-app temp, fired it off with npm start, opened devtools and I get the above message.
It's pointing to line 884 of contentscript.js
Not sure how to cure…

askchipbug
- 87
- 2
- 8
0
votes
1 answer
Tooltip with PopperJs, showing first state unpositioned
https://codesandbox.io/s/intelligent-feynman-j5wzv
If you hover on the button, you will see an effect in the first rendering and then the right position of the Tooltip, Am I missing anything when using popperjs properly?

migueloop
- 525
- 9
- 21
0
votes
1 answer
React: How to use getDerivedStateFromProps() to set component state. It interferes with controlled component that uses the same state variable
I have a component that receives a variable as a prop.
The getDerivedStateFromProps() is typical, meaning that when nextProps.someProp doesn't equal prevState.someStateVar, that prop is assigned to state variable.
I also have a Controlled element -…

GithubGopher
- 1
- 1
0
votes
1 answer
Enzyme setup error: "Jest encountered an unexpected token"
I have a problem setting up enzyme on a project using react-16 as front-end
I've got this error when I try to test
Here is my package.json
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/preset-react":…

George Sendrea
- 31
- 1
- 9
0
votes
0 answers
How to send ref in Provider using React Hook
How to send ref in Provider using React Hook, ExampleRef.current return null? Should return a DOM element with id Example1
create Context
const ExampleContext = React.createContext({});
This is Provider
const ExampleProvider = ({
children
}:{
…

benxmario
- 25
- 1
- 6
0
votes
1 answer
How to Handle Error using try catch using React State with Arrow functions
I am new to React, I am trying to implement some error validation with a react arrow function but got no luck all day.
The catch works and I can print the errors, but I dont know how to link the errors I am printing inside errorsHandler() to the…

CmchPt
- 41
- 7
0
votes
1 answer
How to compile and bundle react 16.9 using gulp 4.0.1?
I have an existing project, I used React 16.9. Now, I want to implement Gulp 4.0.1 to build it in the server. I am running in windows 10.
In my components, I am using import form
I tried using this gulpfile.js, its very simple.
var gulp =…

KD.S.T.
- 573
- 1
- 5
- 27
0
votes
2 answers
Handling out of date state in functional components
I am running into issues setting a state created with the 'useState' hook from within async functions.
I've created a codepen to demonstrate: https://codepen.io/james-ohalloran/pen/ZdNwWQ
const Counter = () => {
const [count, setCount] =…

James
- 2,951
- 8
- 41
- 55
0
votes
1 answer
How to keep calling useEffect method in react until for a condition?
I am trying to update a textarea's value based on an array.
From textToEdit value, on click of show value button I am trying to extract
textToEdit's each line and update the view, the when the use effect gets called do some other logic then call…

Subhendu Kundu
- 3,618
- 6
- 26
- 57
0
votes
2 answers
setState callback is executing before render finish in react 16
I have piece of code,
this.setState({ generateGraphTableforPDF: true }, () => {
this.generatePDFData(true);
this.setState({ generateGraphTableforPDF: false });
});
This setstate callback executes before render finish so, in dom there is no table…