Skip to content

Instantly share code, notes, and snippets.

View datos.py
numeros = [1, 2, 3]
print(numeros)
numeros.append(4)
print(numeros)
listaUno = ['a', 'b']
listaDos = ['x', 'y']
listas = [ listaUno, listaDos ]
View currency.js
const currency = number => {
return number.toLocaleString(
"en",
{
style: "currency",
currency: "USD",
minimumFractionDigits: 2
}
);
}
View productDetailsRouter.jsx
import React from 'react';
import {products} from './products';
const ProductDetails = ({ name, match }) => {
const { params: { productId }} = match;
const product = products[productId];
return (
<div className="product-deatils">
View productDetailsReach.jsx
import React from 'react';
import {products} from './products';
const ProductDetails = ({ name, productId }) => {
const product = products[productId];
return (
<div className="product-deatils">
<h2>Product Details</h2>
View ProductDetailsEmpty.jsx
import React from 'react';
const ProductDetails = () => {
return (
<div className="product-deatils">
<h2>Product Details works!</h2>
</div>
)
};
View produtAlertProp.jsx
<ProductAlerts product={product} notify={onNotify} />
View onNotify.js
const onNotify = () => {
window.alert('You will be notified when the product goes on sale');
}
View ProductAlerts.jsx
import React from 'react';
import {products} from './products';
const ProductAlerts = ({ product }) => {
let productAlerts;
if (product.price > 700) {
productAlerts = <p><button>Notify Me</button></p>;
}
View share.jsx
<button onClick={share}>
 Share
</button>
View if_else_description.jsx
// in the function body
let description;
if (product.description) {
 description = <p>{`Description: ${product.description}`}</p>
}
// Bellow the h3 closing tag
{description}
You can’t perform that action at this time.