All Questions

Tagged with
Filter by
Sorted by
Tagged with
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
-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
0 answers
87 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
0 votes
1 answer
70 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
-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
194 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
0 votes
3 answers
599 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
687 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
-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
529 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
231 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
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
0 votes
1 answer
2k views

Passing javascript function vs use imports in Svelte or React component

I wanted to use some function from javascript module in one of my component. Should I pass it in props when making the component or should I just use Imports in component itself to get the javascript ...
hatellla's user avatar
  • 171
0 votes
0 answers
44 views

Methods for storing data pre-registration in a web app

I have a web app - it's more complicated than a todo list but for simplicity sake let us assume it is a todo list. The user has the choice to sign up and create an account thus allowing them to store ...
William's user avatar
  • 109
0 votes
0 answers
216 views

Handling user permissions in front-end

I'm building an API that will be used by the front-end in React and I'm not quite sure how I should send the permissions of each user based on their roles. Some fields can only be edited in some ...
André's user avatar
  • 137
3 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 ...
dx_over_dt's user avatar
2 votes
1 answer
96 views

continuous deployment of web application built with multiple packages

Our react web application is broken down to multiple components. Some of these components are part of the same git mono repo and some live in a different repo. Now, to implement a bug fix we have to ...
NM Roku's user avatar
  • 29
0 votes
1 answer
195 views

ReactJS - proper way to handle a responsive design approach?

I've always used CSS and media queries when it comes to responsive design. I've been developing in ReactJS for a while, but I feel my approach to responsive design is sloppy. I find myself using a mix ...
sme's user avatar
  • 101
3 votes
1 answer
1k views

How do functional programming advocates use a framework like React or Angular?

I read this blog post recently: The Two Pillars of JavaScript Part 1: How to Escape the 7th Circle of Hell, which is essentially a criticism of object oriented programming, and advocacy for funtional ...
dwjohnston's user avatar
  • 2,553
1 vote
1 answer
209 views

OrderedMap or List for Redux structure?

I'm implementing a Redux store for a React app using redux-saga for API calls. I've used Immutable.js before for other Redux-using React apps but the nature of previous projects always evidently ...
timbo's user avatar
  • 159
5 votes
2 answers
1k views

Benefits of using a JS Framework

I am starting a new project and trying to decide if I should use a Javascript framework (like vue.js or react) and create a Ruby on Rails API, or use Ruby on Rails to server-side render pages and ...
SegFaultDev's user avatar
0 votes
1 answer
83 views

What types of operations should go into Node.js as opposed to client side javascript functions

I am building a web app with a lot of different API calls: our own proprietary REST API, third-party library API calls, etc. All of these calls either retrieve data, update data, delete data, or ...
connected_user's user avatar
10 votes
2 answers
5k views

React: Nested object as state vs individual properties

Are there any use-cases where a nested object as state is either more optimal/easier to work with than individual properties? For instance if I wanted to express some user controls for interacting ...
connected_user's user avatar
0 votes
1 answer
190 views

In the react docs why is binding of *this* preferred over arrow functions for event handlers?

In the React docs, the constructor functions of class components contain lines where this is explicitly bound for event handlers e.g. in the docs for handling events class Toggle extends React....
topher's user avatar
  • 101
0 votes
1 answer
105 views

Thinking about a setup to work with react and front end development

On my team I'm working as a frontend developer in a React codebase. We're building an application and do everything in React. Before this I was actually always a backend developer. Now I have the ...
Vince V.'s user avatar
  • 153
80 votes
4 answers
24k 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 ...
Anyname Donotcare's user avatar
1 vote
2 answers
760 views

Does making a react flash message globally accessible break any conventions?

I read this article where it describes making a flash message in a react app: https://medium.com/@veelenga/displaying-rails-flash-messages-with-react-5f82982f241c They mention adding a reference in ...
unflores's user avatar
  • 402
2 votes
1 answer
893 views

Animations and React -- is it bad practice to mix them?

I have been in arguments with programmers that mixing elements with animations and react is very bad practice, and that all animations should be in a style sheet because that is something ...
Crow's user avatar
  • 121
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( ...
Jichao's user avatar
  • 307
0 votes
1 answer
1k views

Is it necessary to use inline JavaScript with React? Would React therefore get blocked by default by Content Security Policies (CSPs)?

According to https://www.quora.com/What-are-the-key-difference-between-ReactNative-and-NativeScript/answer/Valentin-Stoychev , "ReactNative as using the notation found in React for inlining the UI ...
Daniel's user avatar
  • 171
1 vote
3 answers
158 views

Is it common/appropriate to have a Flux application that combines Actions and Dispatchers?

I just picked up a React/Flux app and I'm new to the technology stack. One of the things that's throwing me off is that just about every tutorial I view on this stack very clearly defines Dispatchers ...
Joe Essey's user avatar
  • 191
12 votes
3 answers
16k views

camelCase, PascalCase, or underscore if you start from scratch with reactjs?

Title says it all. Can't seem to find what is most common out in the world. I'm brand new to programming. If the answer is "it depends", I would love to know what it depends on. Here to learn.
Will's user avatar
  • 133
3 votes
1 answer
176 views

Would a site like stack overflow be better as separate static builds or a single app with run-time switches for each community?

I'm designing a web application. I'd like to use sub-domains to split the site into logic separate sections based on some category - exactly like the stack exchange websites do. I'm currently aware of ...
Ryan's user avatar
  • 131
-1 votes
2 answers
412 views

React.js + Flux, immediate response during history back/forward

In Instagram (web), when you click back/forward arrows - I've noticed that the content isn't loaded from the server and it immediately show up. After reading the docs on react.js + flux, I had this ...
user6227254's user avatar
1 vote
1 answer
408 views

(react.js) when is it appropriate to call stores from non-container components

I believe most people are in agreement that using container components is a good practice - described in this popular post: https://medium.com/@learnreact/container-components-c0e67432e005#.qhw8yfodx ...
Ben's user avatar
  • 113
2 votes
1 answer
624 views

Should all the rendered data be stored in redux store?

Assume your app doesn't need to work offline. Also assume that you want to render some fresh data from server -> Redux store for that data is invalidated every time it's rendered. Does it make sense ...
luboskrnac's user avatar
1 vote
1 answer
245 views

What is the approach for implementing FLUX in a CRUD application that pulls JSON data from the server?

While using FLUX in a CRUD application, according to what I understood, initially the data is returned from an AJAX call and then stored in the STORE. So, all the data that is currently viewed is only ...
Pratish Shrestha's user avatar
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 ...
wrschneider's user avatar
  • 1,329
2 votes
2 answers
86 views

Isormophic javascript, request processing

I was wondering why isomorphic JS, like using reactjs in both client and server side increase first page load ? What is different from simple SPA applications ? In both cases we are loading the full ...
mfrachet's user avatar
  • 1,501
3 votes
0 answers
376 views

Hot swapping files and metaprogramming with front-end JavaScript

I was inspired by a video on hotswapping JS files with React + Webpack for the web. I started trying it out with React + Backbone + RequireJS. Seems to work, as long as I stick to the stateless parts ...
Alexander Mills's user avatar
49 votes
7 answers
7k views

What is the actual value of a consistent code style

I am part of a consultant team implementing a new solution for a customer. I am responsible for the majority of code reviews on the client-side codebase (React and javascript). I have noticed that ...
Andreas Warberg's user avatar