Kattya Cuevas Montes
I am software developer. I love programming and promoting women participation in technology. Organizer of Startup Weekend, FuckupNights, Rails Girls, Django Girls & FLISOL Ica.
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import './index.css';
class App extends Component {
render() {
return (
<div className="App">
<h1>Hello, React!</h1>
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('root'));import React from 'react';
import ReactDOM from 'react-dom';
class AddFriend extends React.Component {
constructor(props) {
super(props)
this.state = {
newFriend: ''
}
this.updateNewFriend = this.updateNewFriend.bind(this)
this.handleAddNew = this.handleAddNew.bind(this)
}
updateNewFriend(e) {
this.setState({
newFriend: e.target.value
})
}
handleAddNew() {
this.props.addNew(this.state.newFriend)
this.setState({
newFriend: ''
})
}
render() {
return (
<div>
<input
type="text"
value={this.state.newFriend}
onChange={this.updateNewFriend}
/>
<button onClick={this.handleAddNew}> Add Friend </button>
</div>
)
}
}
class ShowList extends React.Component {
render() {
return (
<div>
<h3> Friends </h3>
<ul>
{this.props.names.map((friend) => {
return <li> {friend} </li>
})}
</ul>
</div>
)
}
}class FriendsContainer extends React.Component {
constructor(props) {
super(props)
this.state = {
name: 'Tyler McGinnis',
friends: [
'Jake Lingwall',
'Sarah Drasner',
'Merrick Christensen'
],
}
this.addFriend = this.addFriend.bind(this)
}
addFriend(friend) {
this.setState((state) => ({
friends: state.friends.concat([friend])
}))
}
render() {
return (
<div>
<h3> Name: {this.state.name} </h3>
<AddFriend addNew={this.addFriend} />
<ShowList names={this.state.friends} />
</div>
)
}
}
ReactDOM.render(<FriendsContainer />, document.getElementById('root'));FilterableProductTable
SearchBar
ProductTable
ProductCategoryRow
ProductRow
function App() {
return (
<div className="App">
<h1>Hello World</h1>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const PRODUCTS = [
{
category: "Sporting Goods",
price: "$49.99",
stocked: true,
name: "Football"
}
];
const ProductTable = () => {
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
{PRODUCTS.map(product => {
return (
<tr>
<td>{product.name}</td>
<td>{product.price}</td>
</tr>
);
})}
</tbody>
</table>
);
};function App() {
return (
<div className="App">
<h1>Hello World</h1>
<ProductTable />
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const PRODUCTS = [
{
category: "Sporting Goods",
price: "$49.99",
stocked: true,
name: "Football"
}
];
const ProductTable = () => {
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
{PRODUCTS.map(product => {
return <ProductRow product={product} />;
})}
</tbody>
</table>
);
};const ProductRow = ({ product }) => {
return (
<tr>
<td>{product.name}</td>
<td>{product.price}</td>
</tr>
);
};
function App() {
return (
<div className="App">
<h1>Hello World</h1>
<ProductTable />
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const PRODUCTS = [
{
category: "Sporting Goods",
price: "$49.99",
stocked: true,
name: "Football"
}
];
const ProductTable = ({ searchValue }) => {
let products = PRODUCTS.filter(product => product.name.includes(searchValue));
return (
<table>
<thead>
<tr>
<th>Name</th>
<th>Price</th>
</tr>
</thead>
<tbody>
{products.map(product => {
return <ProductRow product={product} />;
})}
</tbody>
</table>
);
};
const ProductRow = ({ product }) => {
return (
<tr>
<td>{product.name}</td>
<td>{product.price}</td>
</tr>
);
};const SearchBar = ({ searchValue, handleChange }) => {
return (
<form>
<input
type="text"
placeholder="Search"
value={searchValue}
onChange={handleChange}
/>
</form>
);
};
class App extends Component {
state = {
searchValue: ""
};
handleChange = e => {
this.setState({ searchValue: e.target.value });
};
render() {
return (
<div className="App">
<h1>Hello World</h1>
<SearchBar
searchValue={this.state.searchValue}
handleChange={this.handleChange}
/>
<ProductTable searchValue={this.state.searchValue} />
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);By Kattya Cuevas Montes
I am software developer. I love programming and promoting women participation in technology. Organizer of Startup Weekend, FuckupNights, Rails Girls, Django Girls & FLISOL Ica.