Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar
Catching bugs

Jonatan del Valle jonidelv

Catching bugs
View GitHub Profile
View menu.jsx
// Codesandbox of example working
import React, { useState, useCallback, useEffect, useMemo } from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const httpPatch = (url, data) => {
return new Promise((resolve) => {
setTimeout(() => {
alert(`Patching ${url} with data: ${JSON.stringify(data)}`);
jonidelv / controlled & uncontrolled
Created December 27, 2021 03:00
Controlled and Uncontrolled components
View controlled & uncontrolled
jonidelv / React
Last active June 21, 2020 23:19
React Portals
View React

React Portals

What are Portals? how and when to use it

React v16 introduced a new feature called portals. Portals provide a quick and easy way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. React render the entire app under a single DOM node — the app root. But what if you want to render children outside the root DOM node? that's when you use Portals.


jonidelv / Spread attributes and Destructuring props in
Last active August 12, 2019 08:48
Spread attributes and Destructuring props in Components
View Spread attributes and Destructuring props in
jonidelv / Refs, React and
Last active July 31, 2019 03:49
Refs, React and Redux
View Refs, React and
jonidelv / React
Last active May 26, 2019 22:40
React SyntheticEvent
View React
jonidelv / Redux
Last active March 29, 2019 07:01
Redux Store
View Redux
jonidelv / Computed Properties in
Last active March 11, 2023 17:14
Computed Properties in React
View Computed Properties in

Computed Properties in React

Achieving Computed Properties the right way

React does not have computed properties out of the box like others frameworks do (Ember, Vue, etc.) so, how can we achieve this behaviour the right way ? The most common practice is to "compute" things in the render method if is a class component or just in the body if is a function component.

jonidelv / Fragments in
Last active February 9, 2019 18:22
Fragments in React and <>
View Fragments in
jonidelv / Functional component to
Last active January 30, 2019 20:18
Functional component to pure
View Functional component to