Questions tagged [react]

68 questions
545
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,453
  • 3
  • 14
  • 6
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
  • 1
  • 2
  • 6
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,…
Ish Thomas
  • 257
  • 3
  • 12
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
  • 1
  • 3
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…
Elliot Smith
  • 59
  • 1
  • 5
3
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,…
mrseanbaines
  • 131
  • 1
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
  • 177
  • 7
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
  • 200
  • 7
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
  • 219
  • 1
  • 7
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
  • 4
2
votes
0 answers

How authorize web application and manage sessions

i am building a single page react app that uses redux as state manager and an express node js as backend server but i don't know what is the best way to authorize my users in the application! if it was php or express-js website i could use…
amin msh
  • 129
  • 1
2
votes
1 answer

Render constant props components from an object or by hand?

Lets say I have a component that render some "static" information and another one that is the parent of these components. function Foo(){ ... return (
Vencovsky
  • 351
  • 3
  • 8
1
2 3 4 5