Skip to content

Instantly share code, notes, and snippets.

{
"cols": [
"people",
"dates",
"zips",
"companies"
],
"data": [
[
"Nigel",
# Exhibit A: long form way of installing packages
npm install eslint-config-airbnb eslint-config-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-html eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-prettier
# Exhibit B: using brace expansion
npm install eslint-{config-{airbnb,pretter},plugin-{react-hooks,react,html,import,jsx-a11y,prettier}}

Intro

1. Show Array

  • Let's pretend for a second that this pplFromAPI array isn't hardcoded, and instead it's being returned to us depending on service calls elsewhere in our application.
  • It's our job to transform this data into a 1dimensional array for the UI to iterate over and display accordingly.

2. - const flattenData = (arr = peopleArray) => [].concat(...ar)

  • One way of implementing this is using .concat in conjunction with the ...spread operator introduced with the release of ES6.

3 "highligh dots"

Shields us having to iterate thru each nested array, building up the final value on each pass.

Intro

1. Show Array

  • Let's pretend for a second that this pplFromAPI array isn't hardcoded, and instead it's being returned to us depending on service calls elsewhere in our application.
  • It's our job to transform this data into a 1dimensional array for the UI to iterate over and display accordingly.

2. - const flattenData = (arr = peopleArray) => [].concat(...ar)

  • One way of implementing this is using .concat in conjunction with the ...spread operator introduced with the release of ES6.

3 "highligh dots"

Shields us having to iterate thru each nested array, building up the final value on each pass.

Mostly Adequete FP Notes

Chapter 9

var Container = function(x) {
  this.__value = x;
}

Container.of = function(x) { return new Container(x); };
@tgrecojs
tgrecojs / component.js
Last active March 12, 2018 21:07
source/Banner/component.js
const Image = ({headline, bgColor, image }) =>
<div className="banner" style={{background: bgColor}}>
<img className="bannerImage" src={`${image.url}`} alt="tg banner"/>
<h2>{headline}</h2>
</div>
export default Image;
query API {
post1: BlogPosts(id: "5aa48ebb5150d400139136c9") {
postBody
description
_meta {
name
}
}
post2: BlogPosts(id : "5aa4a49c106e4d0013bf87d8") {
postBody
import Banner from '../source/Banner/component';
import Post from '../source/Post/component';
import Link from 'next/link';
import { post1, post2, post3 } from '../Posts.tipe';
import Layout from '../source/Layout/component';
const App = () =>
<Layout>
<Banner />
query API {
post1: BlogPosts(id: "5aa48ebb5150d400139136c9") {
calender
postBody
description
_meta {
id
name
}
}