Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [reactjs]

React is a JavaScript library for building user interfaces. It uses a declarative, component-based paradigm and aims to be efficient and flexible.

2367 votes
68 answers
3.1m views

Error message "error:0308010C:digital envelope routines::unsupported"

I created the default IntelliJ IDEA React project and got this: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (...
a1cd's user avatar
  • 24.3k
2335 votes
49 answers
1.7m views

How to programmatically navigate using React Router?

With react-router I can use the Link element to create links which are natively handled by react router. I see internally it calls this.context.transitionTo(...). I want to do a navigation. Not ...
George Mauer's user avatar
2054 votes
85 answers
2.1m views

Loop inside React JSX

I'm trying to do something like the following in React JSX (where ObjectRow is a separate component): <tbody> for (var i=0; i < numrows; i++) { <ObjectRow/> } </...
B Robster's user avatar
  • 41.7k
1478 votes
27 answers
653k views

What are these three dots in React doing?

What does the ... do in this React (using JSX) code and what is it called? <Modal {...this.props} title='Modal heading' animation={false}>
Thomas Johansen's user avatar
1447 votes
32 answers
986k views

How to pass props to {this.props.children}

I'm trying to find the proper way to define some components which could be used in a generic way: <Parent> <Child value="1"> <Child value="2"> </Parent> There is a logic ...
plus-'s user avatar
  • 46.3k
1278 votes
63 answers
871k views

React-router URLs don't work when refreshing or writing manually

I'm using React-router and it works fine while I'm clicking on link buttons, but when I refresh my webpage it does not load what I want. For instance, I am in localhost/joblist and everything is fine ...
DavidDev's user avatar
  • 13.1k
1124 votes
8 answers
282k views

Why use Redux over Facebook Flux? [closed]

I've read this answer, reducing boilerplate, looked at few GitHub examples and even tried redux a little bit (todo apps). As I understand, official redux doc motivations provide pros comparing to ...
VB_'s user avatar
  • 45.5k
1112 votes
23 answers
1.6m views

Can you force a React component to rerender without calling setState?

I have an external (to the component), observable object that I want to listen for changes on. When the object is updated it emits change events, and then I want to rerender the component when any ...
Philip Walton's user avatar
1066 votes
31 answers
1.3m views

Understanding unique keys for array children in React.js

I'm building a React component that accepts a JSON data source and creates a sortable table. Each of the dynamic data rows has a unique key assigned to it but I'm still getting an error of: Each ...
Brett DeWoody's user avatar
1063 votes
30 answers
739k views

How do I conditionally add attributes to React components?

Is there a way to only add attributes to a React component if a certain condition is met? I'm supposed to add required and readOnly attributes to form elements based on an Ajax call after render, but ...
Remi Sture's user avatar
  • 12.7k
1044 votes
16 answers
398k views

Difference between npx and npm?

I have just started learning React, and Facebook helps in simplifying the initial setup by providing the following ready-made project. If I have to install the skeleton project I have to type npx ...
Paresh Maniyar's user avatar
972 votes
28 answers
1.1m views

How to set focus on an input field after rendering?

What's the react way of setting focus on a particular text field after the component is rendered? Documentation seems to suggest using refs, e.g: Set ref="nameInput" on my input field in the render ...
Dave's user avatar
  • 11.7k
949 votes
23 answers
853k views

Call child method from parent

I have two components: Parent component Child component I was trying to call Child's method from Parent, I tried this way but couldn't get a result: class Parent extends Component { render() { ...
N8FURY's user avatar
  • 9,830
925 votes
45 answers
425k views

What is the difference between React Native and React?

I have started to learn React out of curiosity and wanted to know the difference between React and React Native - though could not find a satisfactory answer using Google. React and React Native seems ...
shiva kumar's user avatar
  • 11.4k
917 votes
57 answers
964k views

Detect click outside React component

I'm looking for a way to detect if a click event happened outside of a component, as described in this article. jQuery closest() is used to see if the target from a click event has the dom element as ...
Thijs Koerselman's user avatar

15 30 50 per page
1
2 3 4 5
32077