A Pen by Yerlin Matu on CodePen.
Last active
May 24, 2017 22:15
-
-
Save YerlinMatu/99ddf8ce0de287a349bb42cbab60cb36 to your computer and use it in GitHub Desktop.
Learning State In React Elimination Stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<main id="app"> | |
</main> | |
</html> |
A Pen by Yerlin Matu on CodePen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ListaClientes = [ | |
{nombre:'Juan' , ciudad:'Cali', edad:27}, | |
{nombre:'Peter', ciudad:'Cali', edad:31}, | |
{nombre:'Ana' , ciudad:'Barranquilla', edad:28}, | |
{nombre:'Oscar', ciudad:'Quibdó', edad:24}, | |
{nombre:'Dani' , ciudad:'Quibdó', edad:43}, | |
{nombre:'Pedro', ciudad:'Bogotá', edad:25}, | |
{nombre:'Pablo', ciudad:'Medellín' , edad:34}, | |
{nombre:'Marta', ciudad:'Medellín' , edad:23} | |
]; | |
function Eliminar(){ | |
ListaClientes.pop(); | |
return ReactDOM.render(<GentilTag/>, document.getElementById('app')); | |
} | |
let gentilicio = _.where(ListaClientes, {ciudad:'Medellín'}); | |
class GentilTag extends React.Component{ | |
constructor(props){ | |
super(props) | |
} | |
getInitialState(){ | |
return { title: 'Eliminación en Pila'} | |
} | |
render(){ | |
this.state = ListaClientes.map(user=>{ | |
return ( | |
<tr> | |
<th>{ user.nombre }</th> | |
<th>{ user.edad }</th> | |
<th>{ user.ciudad }</th> | |
</tr> | |
) | |
}) | |
return ( | |
<div className="container"> | |
<h3>ELIMINACIÓN EN PILA</h3> | |
<input ref="person" type="text"/> | |
<button class="btn" onClick={ Eliminar }>Eliminar</button> | |
<table> | |
<thead> | |
<tr> | |
<th><strong>Nombre</strong></th> | |
<th><strong>Edad</strong></th> | |
<th><strong>Ciudad</strong></th> | |
</tr> | |
</thead> | |
<tbody> | |
{ this.state } | |
</tbody> | |
</table> | |
</div> | |
) | |
} | |
} | |
ReactDOM.render(<GentilTag/>, document.getElementById('app')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$red:#E53A40; | |
html{ | |
background-image: linear-gradient(80deg, #d299c2 0%, #c3cfe2 100%); | |
} | |
.container { | |
margin:0 auto; | |
display:block; | |
width:80%; | |
h3 { color:#1F2124} | |
thead { | |
color:black; | |
text-transform:uppercase; | |
} | |
tbody th{ | |
color:black; | |
} | |
button{ | |
float:right; | |
background-color:$red; | |
border-color:$red; | |
color:black; | |
border-bottom:4px red solid; | |
&:active{ | |
color:white; | |
border-bottom:none; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css" rel="stylesheet" /> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment