Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [reactjs]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
153 views

Is it a good idea to serve a Single Page Application as a static site?

I've built a small single-page web application in React and seen that it's possible to serve the app as a static site on something like S3. Previously, I considered using Nginx, but as this is lower ...
Connor's user avatar
  • 159
0 votes
1 answer
158 views

Monorepo dilemma: Where do you store your common business logics?

In my current monorepo structure for frontend, this is how it looks: apps\ jira\ confljuence\ packages ui utils\src (contains common utils like useDebounce.ts, isEmptyObject.ts, etc.) From what ...
nishant_boro's user avatar
0 votes
1 answer
434 views

How could I apply the strategy pattern to a react component? [closed]

For the following component, how would I extract the unit logic to allow for composition? In my actual app I am trying to reduce the amount of logic encoded in the component and I have decided that ...
Tyler Kasper's user avatar
0 votes
1 answer
120 views

How to actually use global state in React?

In my company, all of the projects use at least some kind of global state library like Redux and MobX. However, the actual usage is limited to storing fetched data, and it lacks any caching logic or ...
Erick Christian's user avatar
-1 votes
1 answer
143 views

Best approach to communicate C++/Python and Front-End

I work with Computer Vision applications, mainly in Python and C++. Recently, I get involved with a customer that wants to create a UI based on React JS to visualize the results of our software in ...
mbenencase's user avatar
1 vote
3 answers
1k views

Best strategy to push client-side updates to server?

I'm just starting to build a web app using React.js, Next.js, Prisma, & PostgreSQL. In this web app, users can create "projects", which are represented by 10-15 rows in the database. ...
BurstWizard's user avatar
0 votes
1 answer
153 views

Is it OK to stick with object graph in React State and should I make helpers for handling it?

I am trying to build ERP application using React frontend and I have not found decisive answer whether to use object graphs in React state? E.g. I would like to build Invoice view and I have the ...
TomR's user avatar
  • 1,003
0 votes
1 answer
143 views

Avoiding "handler creep" in React components?

An issue I find myself having with code layout in my React components is that I end up having to define too many handlers. I generally write only functional components with hooks, but within the body ...
temporary_user_name's user avatar
-1 votes
1 answer
99 views

"Select All" in Table is now sending too much data to Server via API - Alternative Ways to Send to Server?

Outline of the current architecture of our web app outlining the issue I'm seeing Client-side app is React, talking to a server running the Play! framework via an API. On the page is a table that ...
bluedevil2k's user avatar
0 votes
1 answer
115 views

design pattern advice on method of "injecting" html in React

Say I have a ReactNode post: const Post = (props:{content:string}) => { return( <div> {textProcessor(props.content)} </div> ) } the role of textProcessor is to 1. to ...
Leftover Salad's user avatar
4 votes
1 answer
802 views

Need a deeper understanding of how a Virtual DOM is different from a real DOM

As all articles say the Virtual DOM is lightweight and allows us to update only those nodes that has to be updated, unlike the real DOM that updates the whole nodes structure. So the first question: ...
devdevdove's user avatar
0 votes
1 answer
599 views

Clean Architecture for React App: Component / View / Page

Abstract I'm trying to figure out a solid, scalable, clean and practical architecture for react projects. As a a playground I have a project with two Screen and a JSON server. When I try to apply a ...
DarkTrick's user avatar
  • 207
0 votes
0 answers
118 views

Identify Domain Entities for a search tool interface - Clean Architecture

I am pretty new to Clean Architecture / Onion Achitecture, I actually not sure if the 2 terms are exchangeable. So it pretty clear to me, considering is a few days I am reading and study about it. It ...
Carmine Tambascia's user avatar
0 votes
3 answers
2k views

Optimal method of storing image thumbnails

I'm working on an application with a database containing many recipes. The API is written in Django (with Django REST Framework) and frontend in React.Each recipe is assigned a high-quality image. In ...
gandalf113's user avatar
1 vote
2 answers
1k views

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 ...
Kenneth Dang's user avatar
0 votes
0 answers
89 views

Effective cache solution to have the newest data in React Native

Goal We have an app with different articles. I want to cache an article when the user has read it, but make sure that I display the latest data. I came up with this hook: React.useEffect(() => { ...
Gh05d's user avatar
  • 101
1 vote
2 answers
2k views

Preventing parent component re-rendering of a big React component when you "Lift State Up"

I have a very big form - let's call it <MyForm> - consisting of the following: text fields and dropdowns custom selector made of selectable cards table input (for this example 50 rows with each ...
Hans's user avatar
  • 121
0 votes
3 answers
200 views

What pattern is a function that returns a component?

Ok I have a bunch of components that all have the same logic but have different css classes. So I wanted to create a sort of factory function that takes the names of the classes as its argument and ...
kaan_a's user avatar
  • 155
0 votes
1 answer
71 views

NextJs Explanation on Ecommerce and Other Project Implementation [closed]

I'm attempting to create a project to increase and enhance my coding skills, and I've lately migrated React to Nextjs. I've noticed that NextJs' main point or strength is rendering; Could someone ...
Mohammad Khan's user avatar
0 votes
1 answer
218 views

Replacing ASP.Net 4 app with microservices and React

Backstory: My new employer has Dynamics CRM on-prem and it is used by all office staff and other colleagues that are consultants. All other employees are a working force out on various construction ...
MrDim's user avatar
  • 1
-1 votes
1 answer
147 views

Where should I put/handle periodic data updates in React?

I'm following the guide in https://reactjs.org/docs/thinking-in-react.html which makes sense for data that I request and update on a filter. However, I want to have some sort of general ...
Archimedes Trajano's user avatar
0 votes
1 answer
56 views

Anyone have data on impact on UX of shipping profiling build in production to users?

I understand that using the React Profiler in production should have a small or negligible impact on user experience at least for profiling 20-50 (guess) components on a page. I would like to know if ...
larrydalmeida's user avatar
1 vote
2 answers
459 views

React: Ternary operator within component vs outside component

I have a pull request and this pr is being reviewed by co-worker. Context I'm using React and a specific component has ternary operator within component like below. const ExampleComponent = (): React....
undefined's user avatar
  • 131
1 vote
2 answers
369 views

Best Practice: Should cascading updates be handled by the frontend or the REST API?

I am designing a timesheet app for logging user tasks using React for frontend and Django REST Framework for backend. The database is PostgreSQL and I have a table for recording the tasks with 4 ...
Alvin's user avatar
  • 19
4 votes
1 answer
2k views

Authentication with JWT in HTTP only cookie without refresh token

The motto of the upcoming question is "I don't know what I don't know". I would like to know if there are downsides or security risks with an authentication implementation. Right now, I'm ...
Bennett Dams's user avatar
0 votes
1 answer
243 views

Reactjs with large DB

I am working with a very large SQL database through a frontend reactjs application with a node server intermediary using an ORM for query sanitation. However due to the size of the DB it takes some ...
WesternWarrior's user avatar
-3 votes
1 answer
126 views

Sharing React Native Component as a "black box"

I'm looking for a way to share a React Native component with 3rd parties without having to share the actual source code. Something like a .jar in Java or a .dll for C#. So assuming we have company A ...
Gr3at's user avatar
  • 131
-2 votes
2 answers
928 views

Advice: How to secure access to photos in a React App

I have a React App (created via create-react-app) secured with OAUTH2. Currently all dynamic content is via REST APIs, secured with the same OAUTH2 token issued at login. It is hosted on AWS. I want ...
Kevin's user avatar
  • 19
-1 votes
1 answer
158 views

Loading in and Autocompleting a CSV File React

I'm currently working on a React Application with Firebase that involves a ton of data manipulation and reading. One specific feature is the ability to autofill a form based on a very large CSV file (...
Erol's user avatar
  • 23
-2 votes
1 answer
150 views

Should I repeat my code or use if statement?

A question from a friend: I have multiple usages for the same code, let's say a vertical HTML card. I change the title and a lot of data based on the react component. it feels unnecessary performance-...
Tailer's user avatar
  • 121
-3 votes
1 answer
211 views

Testing a React component which receives a function as a prop

Suppose there's a root <App /> which houses multiple components, one of them being, say <SearchBox />. App component houses the app state (such as searchResults array) and iterates the ...
McDerp's user avatar
  • 75
1 vote
0 answers
108 views

Reactjs + nodejs external authentication flow

I am developing a RESTful application with nodejs in the backend with express.js as middleware. I am also developing a client in Reactjs. I want to use an external authentication service (LDAP/AD/ADFS)...
cervyvin's user avatar
  • 111
1 vote
1 answer
571 views

Is it an anti-pattern on React to search for children with a specific element type?

Context When designing the API of a React component, you may decide to receive props in a more semantical way. Here's a simple example <Modal headerTitle="foo" /> vs <Modal> &...
Christopher Francisco's user avatar
28 votes
13 answers
9k views

Ways to explain code when told it doesn't make sense

As a programmer I have found my code frequently elicits the reaction "I don't understand". Whenever I get this response I try my best to explain my code patiently, and not make anyone feel ...
yeerk's user avatar
  • 500
0 votes
3 answers
639 views

React - When is a backend necessary?

So I'm currently playing around with web development as a project, and I've been looking at React recently. My current issue is that I'm having trouble distinguishing between front and back end ...
B.Iguana's user avatar
2 votes
2 answers
692 views

React says refs and imperative code are not the right tool for showing and hiding dialogs. Why though?

The docs explicitly state this: Avoid using refs for anything that can be done declaratively. For example, instead of exposing open() and close() methods on a Dialog component, pass an isOpen prop to ...
Silly Freak's user avatar
1 vote
1 answer
43 views

what kind of relationship do child components have with components in react?

I'm currently writing a paper on my react frontend and I'm struggeling to find the right verb for the interaction between child-components and components in react. For example: "I have a table ...
RjuJBong's user avatar
1 vote
0 answers
14 views

Best way to allow other components to change table's focused row?

I have displayProjectTable that gets state from reducer projectData and populates itself. Currently displayProjectTable has a local state that stores focusedRowID. My problem is that I want other ...
Wyatt's user avatar
  • 111
4 votes
1 answer
326 views

ReactJS with Elasticsearch App Architecture

I want some advice regarding my architecture and hosting options. I'm attempting to build an e-commerce site for e-books. It will use nestJS for the backend and ReactJS+Typescript for the frontend. ...
Ketra's user avatar
  • 41
-1 votes
1 answer
1k views

Recommend a way to handle multiple UI frameworks in a pattern library

We are setting up a pattern library. It's use is on the one hand to document and display our UI elements in a web view. On the other hand, it should also be the place where components are built. The ...
asti.v's user avatar
  • 9
-2 votes
1 answer
71 views

React class or function for stateful components?

Which is better to use? react class based stateful component or react hooks functional stateful component? I've searched a bit but couldn't find what is preferred to use.
Soul Burn's user avatar
  • 101
5 votes
3 answers
535 views

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 ...
lahory's user avatar
  • 315
2 votes
0 answers
232 views

React Hooks: using state in useEffect without depending on it

I have run into a situation in React where I want to run a function F in a useEffect hook whenever a value V1 from the store changes. F uses another value from the store V2. I only want to run F when ...
Ace's user avatar
  • 597
0 votes
1 answer
393 views

Wrapping ReactJS UX component library in another layer of abstraction, pros and cons?

There's AntD library with various UX components. Right now I required to wrap all components which I'm using in another layer, to make an abstraction. For example, if I'm using AntForm component I ...
Anatoly's user avatar
  • 264
1 vote
0 answers
136 views

Where to place code which synchronizes state of Redux with localStorage?

In our project, I was need to sync a piece of information between localStorage and the Redux state. Actually I subscribed to changes in a localStorage and in Redux, and if change happens in ...
Anatoly's user avatar
  • 264
2 votes
0 answers
149 views

Dependency injection of UI components via React context

In React, it's common for libraries, and app-internal utilities, to used context-based dependency injection. Some examples: function MyComponent() { const client = useApolloClient(); // Apollo ...
Kelley van Evert's user avatar
2 votes
0 answers
2k views

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 ...
Irfan434's user avatar
  • 187
2 votes
1 answer
843 views

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 ( <Bar name="I" {......
Vencovsky's user avatar
  • 371
2 votes
1 answer
98 views

ReactJS - lift state to main container or export a helper?

I'm using ReactJS (React Hooks, specifically) to build an application. Part of that application involves account creation, sign-in, and authentication. I only recently finished the sign-in feature, ...
IceMetalPunk's user avatar
-1 votes
1 answer
213 views

Why is it called a functional component?

A quick google search shows that the question I have has not been asked directly, and so I ask it here. For what its worth, I am learning react, and I come from a C++ background, where as far as I ...
Anon's user avatar
  • 3,613