In other words, you would want to determine if elements in the array are unique. There are several approaches you can take to achieve this.
Let’s take a closer look at our options.
In this approach, we will traverse the array, starting from the first element and for each element, we will compare this element to all the other elements to see if there is a match.
To achieve this…
React hooks help with carrying stateful logic and keeping their lifecycle separate from the view layer lifecycle. They’ve been around since React v16.8 and since people have been avoiding class components in favor of hooks.
One of the somewhat interesting aspects of hooks is their flexibility in terms of composition and abstraction. If a code snippet using different built-in hooks is handling a part of logic that is separate and independent from other parts, it can be abstracted away as a Custom Hook.
Not all the components you write for your React application can be divided into Stateful and Stateless (dumb) categories. There is a 3rd advanced type of component in React called a higher-order component. A higher-order component is a function that takes a component as an argument and returns another component. Check out my other article to see how higher-order components are used in the real world.
One of the common HOCs I write for every project of mine is called
The first way that could cross a developer’s mind is to deeply iterate through a source object’s properties and copy them one by one on the target object. …
Before you read this article, read React’s official document on HOCs if you haven’t read it yet.
Pretty much in any React application, you call an API to fetch some data and use them to render some content in your application.
Since UI components need to show some kind of progress bar, loading indicator, etc to tell users that data is being fetched, it may be cumbersome to implement loading logic in every single component and to pass a loading property from your redux store or your local state to child components. …
1. Callbacks (ES5)
2. Promises (ES6)
3. Async / Await (ES7: still draft)
In this article we are going to cover the first 2 options yet leaving the third one to the audience, probably lots of snippets and…
Fair warning: This solution worked for the certain use case explained in the article back in 2016, the same date this very article was published. It might not work right now!
There are many cases
iframe would be a good solution to use. Although they are kind of dead to HTML and not a lot of developers use it, It could come up to you as a solution to a complicated problem some day.
Knowing a way to communicate through an iframe to parent is such a valuable and time saver. Maybe iframe could tell it’s parents when it’s content…