Created
March 30, 2020 18:09
React FUNdamentals, Step 2 - Query Field Exercise
This file contains hidden or 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, { useState } from 'react' | |
| const App = () => { | |
| const [inputValue, setInputValue] = useState('') | |
| const [isUpper, setIsUpper] = useState(false) | |
| return ( | |
| <main> | |
| <h1>Giphy Search!</h1> | |
| <form> | |
| <input | |
| type="search" | |
| placeholder="Search Giphy" | |
| value={inputValue} | |
| onChange={(e) => { | |
| setInputValue(e.target.value) | |
| }} | |
| /> | |
| </form> | |
| <p style={{ textTransform: isUpper ? 'uppercase' : undefined }}> | |
| You are typing <strong>{inputValue}</strong> in the field. | |
| </p> | |
| <button | |
| type="button" | |
| className="button" | |
| onClick={() => setIsUpper((prevIsUpper) => !prevIsUpper)} | |
| > | |
| To upper ({isUpper ? 'off' : 'on'}) | |
| </button> | |
| </main> | |
| ) | |
| } | |
| export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment