Skip to content

Instantly share code, notes, and snippets.

Table of Contents

Preface

  • Why I'm Writing this book
  • Who is this book for
  • Author's Note
  • Goals of this book
  • Shoutouts
@lkopacz
lkopacz / test.js
Created December 4, 2019 17:25
using within
import { render, within } from "@testing-library/react";
it("testing things", () => {
const { container } = render(
<Component prop={someProp} />
);
const { getByText } = within(container.querySelector(".some-class"));
const getParent = getByText("2010").parentElement;
});
@lkopacz
lkopacz / .block
Created November 4, 2019 17:00
Map-with-Latitude-Longitude
license: mit
@lkopacz
lkopacz / .block
Created September 18, 2019 19:18
Multiple line graph in v4
license: mit
@lkopacz
lkopacz / .block
Last active September 18, 2019 20:13
Simple line graph with v4
license: mit
@lkopacz
lkopacz / example.test.js
Created July 25, 2019 17:07
testing library - debug!
import React from "react";
import { render, cleanup } from "@testing-library/react";
import MyComponent from "../MyComponent";
afterEach(cleanup);
it("expects it to test something", () => {
const { debug } = render(<MyComponent />);
@lkopacz
lkopacz / .block
Last active July 11, 2019 15:45
Pie Chart (d3js v4)
license: mit
@lkopacz
lkopacz / index.html
Created May 30, 2019 00:12
VSCode Code Example Headers
<header>
<nav>
<ul>
<li><a href="http://"></a></li>
<li><a href="http://"></a></li>
<li><a href="http://"></a></li>
</ul>
</nav>
</header>
@lkopacz
lkopacz / index.html
Created May 15, 2019 17:04
JavaScript Event Listeners
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title of the document</title>
</head>
<body>
<button id="button">
Open
</button>
<script src="script.js"></script>
@lkopacz
lkopacz / index.html
Last active May 15, 2019 17:05
Semantic HTML buttons
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title of the document</title>
</head>
<body>
<!--This doesn't work when you press Enter and
there's a click event -->
<div id="button-1" role="button" tabindex="0">
Open