Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 167260

React is a JavaScript library for building user interfaces. It uses a declarative paradigm that makes it easier to reason about your application and aims to be both efficient and flexible.

1 vote
Accepted

Rendering the form of a model with many different complex inputs in React.js

Separate style out into the CSS if you want - this will de-clutter the JSX code a bit, allowing it to focus primarily on content and logic rather than style and presentation. For example, it'd be nice …
CertainPerformance's user avatar
2 votes
Accepted

Using conditional if in react

The only thing that changes in the JSX is the download button, so it'd be more appropriate to use conditional rendering when the JSX comes to that line to decide whether you need to render the last bu …
CertainPerformance's user avatar
5 votes
Accepted

Code to change the size of the fields based on that 2 fields are optional inside a contact form

I think your current code looks pretty reasonable. All the logic you're typing out is required, and it's quite readable as-is. There are a few tweaks you can consider, but there could well be differen …
CertainPerformance's user avatar
1 vote
Accepted

Is there more elegant way than using if - else to append or update the data array in a React...

Note that you do the same thing if the array is empty or if the last item's localeDate doesn't match - you can combine those two paths. You only want to update the existing object if the last item ex …
CertainPerformance's user avatar
1 vote
Accepted

React Component Reuse with 2 similar components

You can take advantage of conditional rendering to concisely render the iconFile if it exists, and use the conditional operator to construct the outer class name. Using two separate classes for nearly …
CertainPerformance's user avatar
2 votes
Accepted

A simple phonebook in React

There are a bunch of small improvements you can make. Since you aren't using name or setName, you can remove them and their useState call (consider a linter to warn on unused variables). You have <f …
CertainPerformance's user avatar
2 votes
Accepted

Multi Selection Component with Filter (React + Hooks)

There are a few places in the code where you have an array and you want to construct another array from it. Rather than forEach followed by push, it's more appropriate to use Array.prototype.map to tr …
CertainPerformance's user avatar
3 votes
Accepted

React wrapper for existing library

flvPlayerRef? In the constructor, you have this.myRef = React.createRef(); this.flvPlayerRef = element => { this.flvPlayerRef = element; }; This is pretty confusing. The property is either a functi …
CertainPerformance's user avatar
13 votes

Returning the last segment of a split string

I'm not entirely enthusiastic about either. The parts[parts.length - 1] using manual index lookup and subtraction may well take a moment to recognize, "Oh, this is getting the last element of the arra …
CertainPerformance's user avatar
1 vote
Accepted

Simple React component to show sorted articles

Date sorting Your dates are of the format YYYY-MM-DD. You currently sort them with: (a, b) => b.date > a.date ? 1 : b.date === a.date ? 0 : -1 When you want to lexiographically compare strings to det …
CertainPerformance's user avatar
3 votes
Accepted

Javascript / React data mapper

Condition bug Your current implementation has a bug. Your lines like these have the problem: (secondaryStatus === 'payment1' || 'payment2' || 'payment3') JavaScript only has unary operators, binary o …
CertainPerformance's user avatar
2 votes
Accepted

TodoItem component type checking for optional prop

Make the shapes the same In my experience, TypeScript is easiest when similar data has the same shape (type). Rather than conditionally passing a markCompletedTodo, consider passing that prop uncondit …
CertainPerformance's user avatar
2 votes
Accepted

Turning on/off setInterval locating - using React.js

Typo? I think you meant to set isDragged to false when dragging finishes: onDragEnd={() => { setIsDragged(false); }} Note that you don't need to declare parameter you don't use (and probably should …
CertainPerformance's user avatar
2 votes

Small Counter by typescript with React

React.FunctionComponent probably isn't necessary - it's boilerplate for every single component you have, and arguably makes typings a bit worse, not better. See this article. For example, you could ac …
CertainPerformance's user avatar
1 vote
Accepted

ReactJS paginated component with React Router

Your code looks quite reasonable. There are only a few small things I notice: Indent the JSX in App a bit more: ScrollToTop is a child of Router, so it should be indented further, not on the same lev …
CertainPerformance's user avatar

15 30 50 per page