Questions tagged [typescript]

Typescript is a language which is a super set of JavaScript

Filter by
Sorted by
Tagged with
-3 votes
0 answers
27 views

How do i change this code to better, using ReactJS with useMemo hook? [closed]

This is a good code practice? ...
Dev Marcell's user avatar
1 vote
0 answers
73 views

To-do app with TypeScript backend (violations of TS best practices or unidiomatic code)

The working code in full is here. It's a To-Do App with a TypeScript backend, written as practice for an upcoming 4-hour interview for a TypeScript backend role. My colleague and I would like to know, ...
Andrew Cheong's user avatar
0 votes
0 answers
22 views

Seeking Feedback on React Authentication System Implementation

I've developed a React authentication system for my application and would like to receive feedback on its correctness and potential improvements. Below is an overview of the key components and ...
Avishka Dambawinna's user avatar
0 votes
0 answers
31 views

Scaffolding through my own language (Rapid Application Development)

I'm developing a webapp where some parts that repeat, so I made source code to generate source code. I had a lot of fun using Spring-Roo and Grails in the past but was sad that the difference between ...
Grim's user avatar
  • 602
2 votes
0 answers
24 views

React/Typescript/Redux Tool Kit work flow for Category component

I'm quite new to React hooks/Typescript/Redux. I'm building a mock e-Commerce website for my portfolio. I've got a component (Category) working and rendering data with no issues, it follows the below ...
Corey's user avatar
  • 21
0 votes
0 answers
18 views

Reusable HorizontalItemList component in React and Typescript

I'm new to React and need to display a horizontal list of items at several places in my app in differing sizes and styles. This is a utility component I came up with: ...
csmathhc's user avatar
  • 153
2 votes
1 answer
253 views

Efficient browser `StorageEvent` handling

I have this class EfficientStorageEventProvider, which is responsible for efficient handling of StorageEvent ...
Ivan Ivanyuk's user avatar
0 votes
0 answers
24 views

React equivalent to Blazor singelton pattern

I'm refactoring a code-base in React, and our design team have decided to move a button out of its usual flow and instead to a component that's very much not a descendant of the logic. I'm relatively ...
BM-'s user avatar
  • 161
0 votes
0 answers
14 views

Handling request failure in Next.js server-side component

I have a server-side component getting an id from the url query string to fetch data before displaying it. Everything works, but the request failure handling looks off. I'm just not sure what to put ...
eloy's user avatar
  • 43
1 vote
2 answers
175 views

Virtual scroller Vue component

Problem The scrolling looks smooth on Windows, but very laggy on Linux (Webkit webview and Webkit browsers). Any thoughts on what could be optimized or what's obviously broken? Demo playground: https:/...
AlekseyHoffman's user avatar
0 votes
0 answers
32 views

Calendar Grid with layering of multiple events

My attempt at coding an adjusting calendar grid. It seems to work in most cases I've tried (although I haven't tested it exhaustively yet) but my DOM is a bit rusty and I wonder if there's better ways ...
Mark Green's user avatar
1 vote
0 answers
30 views

Fully updating DB table with Prisma (TypeScript)

I'm often updating the Pokemon model with more detail. This detail is then sent to the UI to be displayed in the new sections I add over time. Since there are ...
eloy's user avatar
  • 43
3 votes
1 answer
81 views

Random generation of points for the graphs of 3 stock share parameters

I currently studying OOP and related design patterns, and tried to implement random data generation for some stock charts using OOP as an exercise. This code randomly generates data points for 3 ...
Jin22's user avatar
  • 33
0 votes
1 answer
66 views

Parsing fetched data in TypeScript

I use this code to populate a DB with a batch of pokemon entries from the POKEAPI. Since I'm using TypeScript, I added some custom parsing to use the data's type in the code. I've used a mix of ...
eloy's user avatar
  • 43
3 votes
0 answers
61 views

Custom AutoComplete component with Typescript Generics

I've created my own AutoComplete form element based on @nextui-org/autocomplete to be able to use it along with react-hook-form. ...
kursat's user avatar
  • 131
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, ...
Wesley Souza's user avatar
1 vote
0 answers
46 views

Simple Todo app using latest React and TypeScript

I would like to ask your advice on the frontend code of todo app. Main functionalities: The app has authorization and authentication using backend. The CRUD functionality for managing tasks What may ...
J.Olufsen's user avatar
  • 161
2 votes
1 answer
99 views

Move timestamp to the next Monday 10:01 AM [closed]

I've been battling ChatGPT for hours now and can't get satisfied with this simple algorithm in TypeScript. These two (hopefully correct) TypeScript+ReactNative solutions should move the timestamp ...
Slazer's user avatar
  • 121
0 votes
0 answers
22 views

matching generic items

Hello fellow developers I was wondering if anyone, with more understanding of javascript, is able to detect some potential flaws or performance issues with this recursive function. It works as ...
Lwtsde's user avatar
  • 1
3 votes
1 answer
249 views

Find the closest named color

I have a .json file with name (string) and RGB (r, g, b: numbers) with 30.000 key-value pairs. I am looping the json multiple times per second to find the closest name to a given RGB color. Any idea ...
Relik8's user avatar
  • 31
1 vote
1 answer
107 views

Simple Curry function

This is a interview practice question from BFE.dev. Currying is a useful technique used in JavaScript applications. Please implement a curry() function, which ...
Christopher Fimbel's user avatar
1 vote
0 answers
111 views

Simple Table With Collaborative Editing

The following is my React code to create a simple app containing a table which can be edited by multiple people at the same time. Each client connects to a WebSocket via a custom hook. The WebSocket ...
muell's user avatar
  • 11
1 vote
0 answers
46 views

Functional style dependency injection to make business logic unit-testable

My project is a blogging app, which is a recruitment assignment. It is now finished and working. Following function handles updating a comment votes, very similar as on StackExchange sites, preventing ...
jirkamat's user avatar
  • 111
0 votes
0 answers
69 views

Typewriter component that updates span one char at a time in Next.js + TailwindCSS

I have created a Typewriter component that animates a span to display text for my portfolio website. The goal was to have an array of strings that are cycled through and an animation that types them ...
Asad Koths's user avatar
1 vote
3 answers
271 views

List consecutive days

I created this method for consecutive days to be listed with a dash, non-consecutive are separated by “and”. In my UI control I am only getting back a ...
Jefferson's user avatar
  • 361
1 vote
0 answers
66 views

Calculate total running time for movie series

Which of these 2 functions is better and more readable and why? (Both functions do the same thing). My goal is to get the total time of a series, using the TMDB API (which has a limit of 20 different ...
jofyavoydo's user avatar
0 votes
3 answers
73 views

Find an object based on substring value

...
user274262's user avatar
0 votes
1 answer
193 views

Spring Boot Account API with React Frontend and Identicon Integration

I have recently been exploring React and Spring Boot, and I would greatly appreciate your feedback on a practice application that I have developed. The application consists of a Spring Boot backend ...
thebluepandabear's user avatar
0 votes
0 answers
68 views

Removing Brackets and Bracketed Content from a String

I have a site that I made to parse parts of Wikipedia articles for me. Part of this is removing parentheticals and citations. I came up with the following implementation: ...
Christopher Fimbel's user avatar
1 vote
1 answer
319 views

Movies App with Vue 3 and TypeScript

I have made a Movies App with Vue 3, TypeScript and The Movie Database (TMDB) API. For aesthetics, I rely on Bootstrap 5. In src\App.vue I have: ...
Razvan Zamfir's user avatar
1 vote
0 answers
32 views

Asynchronous Generic Resource Pooler

A personal project I'm working on needs Worker (thread) pool. The libraries I looked at were too high-level for my needs, as I simply needed access to the Worker itself while the libraries offered ...
Slava Knyazev's user avatar
0 votes
1 answer
37 views

Creating functions in a hierarchy where they get the same arguments

When I write code, I tend to follow functional paradigms often. The main thing I try to do is use values returned from functions. What I notice though, is I end up having a sort of function argument ...
Vinn's user avatar
  • 119
0 votes
0 answers
70 views

Chaining react hooks using uniswap style template

I'm trying to chain react hooks together. I need to do the following Obtain the Balance of NFT's a user has Enumerate the balance of nft's and generate index arguments to call the RPC to get the ...
Ritzy Dev's user avatar
  • 111
1 vote
0 answers
89 views

Angular Lazy Loading Component into HTML template

I want create a generic component for lazy loading other component Demo online (click on load button) https://stackblitz.com/edit/angular-v7xfwb this is the code ...
ar099968's user avatar
  • 201
5 votes
1 answer
295 views

Most compact data format for a shopping cart

I'm trying to build a format that can represent the user's cart on my website in the most compact way. The website is related to computer parts and there are 23 product categories. Each product has an ...
Raees Iqbal's user avatar
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: ...
John Alberto López Hernández's user avatar
2 votes
0 answers
731 views

React hook to play audio with Web Audio API

My goal was to make playing sounds in my React game easy and efficient. Using <audio> tags wasn't an option, because on mobile it creates huge delays between ...
Robo Robok's user avatar
1 vote
1 answer
151 views

Function component wrapper for the js-year-calendar widget

I have this class component from the rc-year-calendar library. ...
Helder Batalha's user avatar
1 vote
1 answer
130 views

Rock, paper, scissors game in expressjs typescript

This is a simple 2 player game made in NodeJS and the ExpressJS framework with typescript. I've built using OOP approach to as far of an extent as I know of it. I'm really curious as to how further ...
Exodus Reed's user avatar
1 vote
0 answers
647 views

NextJS NextAuth Implementation using Custom Token Source

I am new to NextJS, it has somewhat been forced on me and the existing code was not authenticating correctly (after a period the site would hang - not return to login - this was due to the way we were ...
MoonKnight's user avatar
1 vote
1 answer
65 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 ...
Florian Walther's user avatar
0 votes
2 answers
101 views

Complex statement in typescript get?

I have some get function like this ...
Miomir Dancevic's user avatar
0 votes
1 answer
201 views

Filter based on object field in TypeScript

I have four arrays of the same object which I use for a form. They work as pairs such as list_1 contains all possible values and ...
Neo's user avatar
  • 129
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 ...
Leo Messi's user avatar
  • 181
0 votes
1 answer
224 views

How to reduce the 'useEffect` hook to make more performance

I have created a tab Accordion. at present it works fine. it should: open and close on click ( shuffling ) on click of a tab other tabs should be closed if open ...
3gwebtrain's user avatar
0 votes
1 answer
173 views

Check if string starts with vowel

I am using a template for a text inputs and feedback messages to simplify my html code. This passes in variable string called label and populates the placeholder ...
WhatsThePoint's user avatar
1 vote
2 answers
115 views

Optimizing - formatting a person's name

I need to take a user's name and format it 'lastName, firstName middleName'. If firstName and middleName are not present then the comma should not be included with lastName. Below is what I came up ...
Samuel's user avatar
  • 21
2 votes
2 answers
257 views

React component which uses another component for rendering

Having this React component: ...
Leo Messi's user avatar
  • 181
2 votes
0 answers
221 views

Set-new-password form, including validation

I've got to make a form using Bootstrap and Angular, which validates the following requirements: Old password, new password and confirm password are mandatory fields. New password has to be equal ...
michael.zech's user avatar
  • 4,294
1 vote
1 answer
150 views

A graph interface for Wikipedia

I'm building a graph-based interface to explore Wikipedia, but I'm not really familiar with TypeScript/React (especially state management), so I really feel like I'm just Frankensteining things ...
Janice Lee's user avatar

1
2 3 4 5
11