Skip to content

Instantly share code, notes, and snippets.

View codewithbernard's full-sized avatar

Bernard Bado codewithbernard

View GitHub Profile
import React, { useContext, useState } from "react";
// Settings default values
// These well later be overwritten by specifying 'value'
const ThemeContext = React.createContext({
theme: "light",
setTheme: () => "",
});
const App = () => {
{
type: "SIGN_IN",
payload: {
email: "test@mail.com",
password: "12345"
}
}
const numbers = [27, 52, 28, 122, 67];
// Example 1
const average = arr => arr.reduce((a, b) => a + b) / arr.length
console.log(average(numbers));
// => 59.2
// Example 2
const anotherAverage = arr => {
const sum = arr.reduce((partialSum, nextNumber) => partialSum + nextNumber, 0);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = null;
.container {
display: grid;
place-items: center;
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
.container {
text-align: center;
}
.content {
display: inline-block;
}
.container {
position: relative;
}
.content {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
<div class="container">
<div class="content">I am centered~</div>
</div>
import React from "react";
import { Link } from "react-router-dom";
import { HashScroll } from "react-hash-scroll";
const HashScrollPage = () => {
return (
<main className="page">
<nav>
<ul>
<li>