This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
const Container = ({ children }) => <div>{children}</div>; | |
const AddOneButton = ({ setCounter }) => ( | |
<div> | |
<button onClick={() => setCounter((v) => v + 1)}>Add One</button> | |
</div> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, createContext, useContext } from "react"; | |
const CounterContext = createContext(null); | |
const CounterContextProvider = ({ children }) => ( | |
<CounterContext.Provider value={useState(0)}> | |
{children} | |
</CounterContext.Provider> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Formik } from "formik"; | |
import * as Yup from "yup"; | |
//import Error from "./Error"; | |
import styled from "styled-components"; | |
const Form = styled.form` | |
width: 100%; | |
max-width: 600px; | |
margin: 25px auto; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Formik, Field, ErrorMessage, Form } from "formik"; | |
import * as Yup from "yup"; | |
//import Error from "./Error"; | |
import styled from "styled-components"; | |
const Button = styled.button` | |
background: gray; | |
color: navy; | |
width: 30%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
const size = useWindowSize(); | |
return ( | |
<div> | |
{size.width}px / {size.height}px | |
</div> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="nav-icon"> | |
<div></div> | |
</div> | |
https://codepen.io/chriskavanagh/pen/zYYjZGq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add refs to each element in list using reduce, by creating obj. | |
list = [ | |
{ | |
id: "a", | |
firstname: "Robin", | |
lastname: "Wieruch", | |
year: 1988 | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import Input from "./common/Input"; | |
export default class LoginForm extends Component { | |
state = { | |
username: "", | |
password: "", | |
errors: {} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
export default class LoginForm extends Component { | |
state = { | |
username: "", | |
password: "" | |
}; | |
handleSubmit = e => { | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
export default class LoginForm extends Component { | |
state = { | |
username: "", | |
password: "" | |
}; | |
handleSubmit = e => { | |
e.preventDefault(); |
NewerOlder