Questions tagged [reactjs]
The reactjs tag has no usage guidance.
111
questions
-2
votes
0
answers
24
views
Test web app in development with playwright on BitBucket CI
I'm currently trying to use Playwright and jest-image-snapshot to do visual regression testing on my React front-end. I'm currently using Bitbucket Pipelines for my CI. I'm trying to run both my front ...
1
vote
2
answers
266
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 ...
0
votes
0
answers
15
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(() => {
...
-2
votes
0
answers
37
views
Putting methods in one file or many files in ReactJS?
We are refactoring ReactJS application. It uses Mobx as state management.
Our store became very fat. And we want to refactor it.
Let's say we have a simple store:
export class TodoStore {
...
1
vote
2
answers
92
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 ...
0
votes
3
answers
117
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 ...
0
votes
1
answer
46
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 ...
0
votes
0
answers
56
views
React Redux chain-of-actions pattern - should I create new synchronous middleware for synchronous actions?
I am creating React Web application with Yii2 API and Redux-Saga which calls Yii2 API (asynchronously).
I am stuck with one especially large and complex user action (initiated by the selection of good,...
0
votes
1
answer
66
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 ...
-1
votes
1
answer
42
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 ...
0
votes
1
answer
53
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 ...
0
votes
2
answers
64
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....
1
vote
2
answers
126
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 ...
1
vote
1
answer
733
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 ...
0
votes
1
answer
85
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 ...
-3
votes
1
answer
82
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 ...
-2
votes
2
answers
284
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 ...
-1
votes
1
answer
77
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 (...
-2
votes
1
answer
140
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
44
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 ...
1
vote
0
answers
88
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)...
0
votes
1
answer
416
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>
&...
28
votes
14
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 ...
0
votes
3
answers
202
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 ...
2
votes
2
answers
387
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 ...
1
vote
1
answer
39
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 ...
1
vote
0
answers
13
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 ...
4
votes
1
answer
153
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.
...
-1
votes
1
answer
968
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 ...
-2
votes
1
answer
58
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
438
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 ...
2
votes
0
answers
124
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 ...
0
votes
1
answer
237
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 ...
1
vote
0
answers
122
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 ...
2
votes
0
answers
110
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
...
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 ...
2
votes
1
answer
455
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" {......
2
votes
1
answer
73
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, ...
-1
votes
1
answer
201
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 ...
1
vote
4
answers
425
views
Lead developer wants to use a micro-frontend design pattern. Are my concerns valid?
I'm a React developer at a large company working on an enterprise application which draws on a large amount of data, but performs a very specialized task and has only a handful of internal users. The ...
0
votes
1
answer
1k
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 ...
0
votes
0
answers
34
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 ...
1
vote
2
answers
1k
views
How to effectively handle 404/500 http errors in server-side rendering web application which uses store for state?
I'm working on a website using server-side rendering approach. I'm using React and Redux for this. Redux handles the state of the application and provides API to change the state. All asynchronous ...
3
votes
0
answers
214
views
Architecture and Security in a Web/Native app while generating PDFs
I am trying to make a system where a user can view/download his statements (say salary slips). The user will have ability to download PDF versions of these statements and can also save them to Google ...
2
votes
0
answers
80
views
Where to store the state of a complex form in React?
Let us consider a complex form of registering a driver and owner.
The driver will have all these fields:
driver = {
firstName: "xyz",
lastName: "abc",
phone: "1234",
email: "m@g.com,
licence: "...
1
vote
0
answers
149
views
Is it better to have a default avatar library on client or server side?
I have a webapp using ReactJS as the frontend and Rails as the backend service.
I have an account manager, where a user can choose multiple avatars from a default library. This library contains ...
1
vote
0
answers
512
views
Plugins system for an Electron/React app
I'm developing a Electron/React app which uses Webpack and Asar technologies. It's designed to be a host app providing a common platform for some plugins. These plugins are downloaded and plugged into ...
0
votes
0
answers
107
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 ...
1
vote
1
answer
345
views
Integrate react app with php app
I have an old php web application, with very bad code.
While a lot of it just has html and ajax calls in the, the wrapper is still php.
I want to develop the new modules in react, and slowly replace ...
1
vote
0
answers
200
views
Write integration tests with React using Jest
Let's imagine that we have this Page component:
const Page = () =>
<>
<Topbar />
<Drawer />
<Content />
</>
I'd like to test some interaction within ...