All Questions
Tagged with javascript react.js
307
questions
0
votes
0
answers
30
views
How to shrink a react function code with firebase set/update operations
I have a function which does firebase set and update operations, but it looks messy. I want to shrink it but also make sure that it works the same. Any ideas?
...
2
votes
0
answers
56
views
React draggable sliding panel
I'm building a sliding bottom panel as a React component, adapting Phuoc Nguyen's excellent draggable element tutorial.
It currently looks like this:
The expected behavior is:
User taps on button to ...
1
vote
1
answer
57
views
How to encapsulated javascript code using imutable method?
I have this code, but I need to return pure functions instead the mutating functions.
Is it possible? Perhaps using OOP? I don't know how to improve it.
I tried to return the values in each function, ...
4
votes
1
answer
73
views
access arrow data
I am fetching arrow tabular data from an API. The content-type of the response is application/vnd.apache.arrow.stream. In my react code, I am trying to read the ...
1
vote
0
answers
70
views
Variable button increment picked from an input:range in React 18
I'm a newbye in React. I created some simple Components to practice. For now, I'm using class Component (I want learn either class COmponent or function COmponent).
I would know if I projected ...
1
vote
1
answer
75
views
Tracking people's check-in and check-out at an event
I have some logic that helps me calculate the data for a summary of an event, which should be rendered as something like this:
...
0
votes
1
answer
32
views
Choose a marker for the map based on the alerts it has
I need help to refactor this code, I think I can avoid the first two functions that filter the array. Also in the third part where I use the result of these two filters:
...
1
vote
1
answer
67
views
PaginationBar component that renders links or buttons depending on optional callback prop
I have several components/pages in my personal project that contain complex logic and even nested ternary operators. Since I'm the only person working on this project, I don't have a hard time ...
0
votes
2
answers
108
views
How to write repetitive styled components in a cleaner way
I'm using Styled Components for styling and there are many icons defined in the project so in the style file we have this code:
my-component.styles.ts
...
2
votes
2
answers
258
views
React component which uses another component for rendering
Having this React component:
...
1
vote
0
answers
124
views
Arithmetic expression evaluation class used in a React component
How can I refactor the calculation() function I have used react class-based component for example extracting to separate individual function such as: ...
1
vote
0
answers
140
views
The most efficient way to run a simple useQuery hook when a component mounts
I have a very simple API query (using GraphQL - URQL, but the client used doesn't matter) that just fetches data and displays it on the page, and I’m trying to figure out the most efficient way to ...
1
vote
0
answers
117
views
custom hook in react
I have re-written this javascript code logic to a react custom hook to use.
But it seems like the solution i have made is a bit slow, and heavy on performance, I was wondering in which sort of ways I ...
0
votes
1
answer
287
views
React Custom hooks - useFetch
I created custom hooks, which allows to fetch the API using two request methods 'GET' and 'POST'.
Use cases:
...
1
vote
1
answer
458
views
Constructing routes from imported URL constants
There is a file created with the project paths in a dictionary.
Example:
...