Skip to content

Instantly share code, notes, and snippets.

View agiveygives's full-sized avatar
🤠
YeeHaw

Andrew agiveygives

🤠
YeeHaw
View GitHub Profile
@agiveygives
agiveygives / FunctionalComponent.jsx
Created April 25, 2019 01:34
Testing React State with Hooks, Jest, and Enzyme
import React from 'react';
const TestComponent = () => {
const [count, setCount] = React.useState(0);
return (
<h3>{count}</h3>
<span>
<button id="count-up" type="button" onClick={() => setCount(count + 1)}>Count Up</button>
<button id="count-down" type="button" onClick={() => setCount(count - 1)}>Count Down</button>
@agiveygives
agiveygives / ClassComponent.jsx
Created April 25, 2019 01:17
Testing React State with React Class, Jest, and Enzyme
import React from 'react';
class TestComponent extends React.PureComponent {
constructor(props) {
super(props);
this.state = { count: 0 };
}
render() {
return (