Questions tagged [react]

70 questions
546
votes
6 answers

Pros and Cons of Facebook's React vs. Web Components (Polymer)

What are the main benefits of Facebook's React over the upcoming Web Components spec and vice versa (or perhaps a more apples-to-apples comparison would be to Google's Polymer library)? According to this JSConf EU talk and the React homepage, the…
CletusW
  • 5,463
9
votes
3 answers

React Native - Is using a singleton the best alternative to DI?

I've been reading a lot about the singleton pattern and how it's "bad" because it makes the classes using it hard to test so it should be avoided. I've read some articles explaining how the singleton could be replaced with dependency injection, but…
8
votes
2 answers

Is it antipattern to use React.cloneElement to extend an element?

I'm creating a popover component for a UI in React. That component contains a button that triggers the popover to display. Because the button needs to be configurable--label, classes, properties--I need to pass down these configuration parameters to…
James
  • 209
5
votes
3 answers

How to manage chaotic code explosion in React application

So we decided to redo UI of our web application in React. Six months down the lane and we have a complete mess of components and reducers and thunks and actions and god knows what not. We have multiple files named reducer.ts and each file is…
5
votes
1 answer

Domain classes in DDD structure in React apps?

I'm building an Electron app using React. I'm coming from the C# and WPF world and I'm wondering, where should my domain classes go? I understand the concept of components, but what about a class with no UI, just a lot of methods in it? For example,…
4
votes
2 answers

What is the Advantage of React JS over Pure Javascript + PHP?

What exactly is the purpose of React JS? I've heard a few things, like: It updates the page without refreshing. It is modular and can reduce redundant coding. It is faster than updating the DOM object with JS. The only one I can probably agree…
4
votes
0 answers

How do I architect reordering in database?

I'm building a todo list app and using react-beautiful-dnd on the frontend to allow users to reorder tasks. I'm trying to work out how to persist changes to the database when a user reorders items. With react-beautiful-dnd, when a reorder occurs,…
4
votes
1 answer

Form validation code shared in the frontend and backend API?

I have a legacy Java monolithic web application. My goal is to use React on the frontend, keep Java on the backend and add an API for the frontend to use. My question is how can I write the data validation just once, using it on both the frontend…
Dan
  • 41
4
votes
0 answers

How should a non-React component subscribe and respond to Redux state changes?

I’m new to React/Redux tools and still figuring out some idiomatic design patterns. Here's a scenario: A user adding a place marker (that has some associated metadata) to an interactive map (Leaflet), which should be held in state. I’ve just come…
danwild
  • 149
  • 3
4
votes
1 answer

React: Redux vs Singleton service

An application I'm currently working on in our front end we currently use React, Redux and some singleton services (wrappers around some 3rd party libraries). We started discussing a new feature which we need to develop which involves non-changing…
3
votes
1 answer

Why JS MVC frameworks prefer data binding to UI element reference?

When you are using frameworks like Angular, Angular2+, and React, the way you put data in the UI is by binding a property to an attribute of a UI element. On the other hand, when you're doing standard iOS dev or traditional JS/JQuery dev, you…
Andy
  • 187
2
votes
1 answer

Re-export (certain) library components from barrel file

Situation At the project I'm currently working on we're using Chakra UI to create our UI. But I guess this question applies to whatever (UI) library you're using. There are certain components that need to be customized and so we're creating our own…
Jap Mul
  • 121
2
votes
1 answer

Golang / React Webapp Architecture

A project is structured as so: A build server listens to changes in two repositories: a frontend and backend repo. When it picks up a change it builds, tests, and deploys the updates to a production server that exposes a publicly accessible…
Coupcoup
  • 220
2
votes
1 answer

Using Django Sessions when views are accessed by API

I'm making an app which is a Django backend and a React frontend (being developed by someone else). The plan currently is to fully decouple the two and have them communicate over API. However, I would like to make use of Django's Authentication…
Neil
  • 229
2
votes
0 answers

Updating nested state with React Hooks and Typescript - performance vs clarity

I have some deeply nested react components. Let's limit them to 3 levels of nesting and call them Parent, Children and Grandchildren. The state for the entire app is stored in a single object in the Parent component, and is managed using the…
Irfan434
  • 187
1
2 3 4 5