Questions tagged [react-16]

92 questions
4
votes
2 answers

What is the difference between a fibre object in React 16 and a React Element?

Here on this link (as a lotta people referring to, for understanding React 16's architecture) it is mentioned: Even Elements in React are plain JS objects that contains info about the component, having the following four props: { type, ref, …
UtkarshPramodGupta
  • 7,486
  • 7
  • 30
  • 54
3
votes
1 answer

Webpack not able to find public folder on Production Build

My current folder structure - app - build - public - simulation - index.html - server I have a .html file in the public > simulation folder. and I am opening this HTML file in an iFrame inside a React component export default function…
souravlahoti
  • 716
  • 2
  • 8
  • 29
3
votes
1 answer

Is there a typing for React Function components that includes returning fragments, nulls, strings etc?

My question is a clarification/update on this highly upvoted question: When to use JSX.Element vs ReactNode vs ReactElement? It seems to me that TypeScript is not going to play well when you want to have function components that return primitives…
dwjohnston
  • 11,163
  • 32
  • 99
  • 194
3
votes
0 answers

Single-Spa: Uncaught Error: application 'app1' died in status UNMOUNTING: unmountComponentAtNode(...): Target container is not a DOM element

I have registered 4 react applications using registerApplication of Single Spa. When I am navigating from one app to another I am seeing an error in console as well as an overlay on the browser. Uncaught Error: application 'app1' died in status…
Shreya Shah
  • 582
  • 1
  • 4
  • 17
3
votes
2 answers

Order of 'const' variables in React Stateless Components

Say I have a simple React stateless component like so: const myComponent = () => { const doStuff = () => { let number = 4; return doubleNumber(number); }; const doubleNumber = number => { return number * 2; …
HJordan35
  • 160
  • 2
  • 9
3
votes
1 answer

React Class components vs Functional components

Before React16, class components were used over functional components whenever there is a need to use state or lifecycle methods in your component. In the latest release react introduced Hooks and Effects using which we can use state and lifecycle…
Roopak Puthenveettil
  • 1,387
  • 2
  • 13
  • 27
3
votes
1 answer

react app favicon / manifest not being displayed on gh-pages

I have react/webpack app hosted on gh-pages. Favicon and Manifest icons are not showing. favicons, manifest folder and manifest.webmanifest file are placed in client/assets folder. < favicon setup >, app.js import…
Jiaah
  • 758
  • 2
  • 11
  • 29
3
votes
2 answers

React Routing still showing root component even after using exact

I am still a newbie to React. So here I am rendering the root component with two routes: Home and About located in functional components: home.js and about.js respectively. However, even after using exact attribute and , the root component keeps on…
KNIGHT MAHAJAN
  • 503
  • 1
  • 5
  • 12
3
votes
2 answers

Diagnosing duplicate spec reporting with Karma, Mocha, and React 16.5

I have a project using React for the view layer. To test it, I am using mocha, karma, karma-webpack, etc. For some reason, in React 16+, karma is reporting the afterEach as having run three times for two specs. This happens only in React 16+ and…
jneander
  • 1,150
  • 14
  • 34
3
votes
3 answers

Why React still render the child component with Error Boundary

I use React 16 with Error Boundary functionality: Profile.js class Profile extends Component { constructor(props) { super(props); this.state = { // user: { // name: "Ha (Huck) H.K. NGUYEN" // } user:…
Einsamer
  • 1,069
  • 4
  • 17
  • 34
3
votes
2 answers

Error Boundary does not give access to error if it is an instance of Error class

I came accross a weird behavior. See this fiddle. When using React 16 error handling mechanisme, namely Error Boundary, I noticed the error parameter was empty. Upon further investigation I realised it was only the case when throwing an Error…
Arro
  • 158
  • 1
  • 10
3
votes
1 answer

Issue when implementing ReactDOM.createPortal (react 16 feature)

For the sake of clarification, let's say I have 3 components: , , I am trying to render within , without rendering (from which is called). parent.js class Parent extends Component { …
Constance G
  • 81
  • 1
  • 9
3
votes
1 answer

How can I use a React 16.3 Context provider with redux store?

I'm working in a codebase that has a bunch of redux already working for managing and persisting state, as well as dispatching actions. My goal with the new Context API is to get rid of the prop-drilling that I have to do to deliver all these pieces…
Nick
  • 9,792
  • 7
  • 50
  • 60
2
votes
0 answers

Unit testing of react component having useEffect

I am trying to test useEffect and function calls inside useEffect in below code. It has useEffect and useState hooks. const App = () => { const [search, setSearch] = useState(""); const [images, setImages] = useState([]); const [loading,…
TnJ
  • 43
  • 4
2
votes
2 answers

Difference between passing a ReactElement and a function that returns a ReactElement

Whats the difference between passing a ReactElement as a property: First case } /> function RenderParam({ ReactElement }) { return
{ReactElement}
; } and passing a function that returns a…
Rashomon
  • 5,962
  • 4
  • 29
  • 67