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 https://codesandbox.io/s/react-playground-forked-cmqx5d?file=/index.js:0-5046
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
jonidelv / controlled & uncontrolled components.md
Created December 27, 2021 03:00
Controlled and Uncontrolled components
View controlled & uncontrolled components.md
@jonidelv
jonidelv / React Portals.md
Last active June 21, 2020 23:19
React Portals
View React Portals.md

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.

When

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

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
jonidelv / Fragments in React.md
Last active February 9, 2019 18:22
Fragments in React and <>
View Fragments in React.md
@jonidelv
jonidelv / Functional component to pure.md
Last active January 30, 2019 20:18
Functional component to pure
View Functional component to pure.md