Skip to main content

All Questions

Tagged with
1 vote
3 answers
2k 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. ...
84 votes
6 answers
25k views

Why do many software developers violate the open/closed principle?

Why do many software developers violate the open/closed principle by modifying many things like renaming functions which will break the application after upgrading? This question jumps to my head ...
-1 votes
1 answer
106 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 ...
30 votes
5 answers
13k views

Why is JSX good, when JSP scriptlets are bad?

React.js provides JSX as an XHTML-like syntax for constructing a tree of components and elements. JSX compiles to Javascript, and instead of providing loops or conditionals in JSX proper, you use ...
4 votes
2 answers
5k views

Why are React keys limited to strings?

In React, when rendering a mapping from elements of a list/array/iterable to React elements, we're required to attach a locally-unique key to each element. Generally this is so that if an element ...
0 votes
0 answers
107 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(() => { ...
0 votes
1 answer
82 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 ...
-2 votes
1 answer
154 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-...
-3 votes
1 answer
383 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 ...
2 votes
2 answers
773 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 ...
0 votes
3 answers
938 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 ...
3 votes
1 answer
2k views

How to passing variables from php to react.js component?

For example, I have a react.js component named Question which need the props title,id,content. <div id="main-section"> <div id="question"></div> </div> ReactDOM.render( ...
2 votes
0 answers
250 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 ...
-2 votes
1 answer
73 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.
5 votes
3 answers
609 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 ...

15 30 50 per page