Skip to content

Instantly share code, notes, and snippets.

@ac205
ac205 / CartReducer.jsx
Last active December 10, 2019 00:46
Cart Reducer
const cartReducer = (state = {
cartItems: 0,
items: products,
cartContents: [],
}, action) => {
switch (action.type) {
case "ADD_TO_CART": {
const existingItem = state.cartContents.find(item => {
return item.id === Number(action.payload);
})
@ac205
ac205 / App.css
Last active November 24, 2019 16:43
Weather App
#weatherContainer {
text-align: center;
}
#weatherCard {
text-align: center;
margin: 50px auto;
width: 100%;
}
@ac205
ac205 / App.js
Last active November 24, 2019 16:42
Login Demo
import React, { useState } from 'react';
import Typography from '@material-ui/core/Typography';
import MyAppbar from './components/MyAppbar';
import MainContent from './components/MainContent';
const App = () => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
return (
<div id="App">
@ac205
ac205 / App.css
Last active November 24, 2019 16:42
RBG Color Changer
.outsideContainer {
height: 90vh;
padding: 5vh;
margin: auto;
}
.container {
background: rgb(248, 248, 248);
width: 50%;
margin: auto;
text-align: center;