Created
March 30, 2020 18:09
-
-
Save benmvp/f977114f5c3317a6e5d61f5e9e18189a to your computer and use it in GitHub Desktop.
React FUNdamentals, Step 2 - Query Field Exercise
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, { 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