Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c4943fa

Browse files
Zara603Kent C. Dodds
authored and
Kent C. Dodds
committed
PokemonCacheProvider wrapper place moved (#4)
* update 4.0 PokemonCacheProvider wrapper place moved * update final 4.0
1 parent 1fd7d6a commit c4943fa

File tree

2 files changed

+78
-76
lines changed

2 files changed

+78
-76
lines changed

‎src/exercises-final/04.js‎

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -163,50 +163,51 @@ function Usage() {
163163
}
164164

165165
return (
166-
<PokemonCacheProvider>
167-
<div style={{display: 'flex', flexDirection: 'column'}}>
168-
<form
169-
onSubmit={handleSubmit}
170-
style={{
171-
display: 'flex',
172-
flexDirection: 'column',
173-
alignItems: 'center',
174-
}}
175-
>
176-
<label htmlFor="pokemonName-input">Pokemon Name</label>
177-
<small>
178-
Try{' '}
179-
<InvisibleButton onClick={() => handleSelect('pikachu')}>
180-
"pikachu"
181-
</InvisibleButton>
182-
{', '}
183-
<InvisibleButton onClick={() => handleSelect('charizard')}>
184-
"charizard"
185-
</InvisibleButton>
186-
{', or '}
187-
<InvisibleButton onClick={() => handleSelect('mew')}>
188-
"mew"
189-
</InvisibleButton>
190-
</small>
191-
<div>
192-
<input
193-
id="pokemonName-input"
194-
name="pokemonName"
195-
value={pokemonName}
196-
onChange={handleChange}
197-
/>
198-
<button type="submit">Submit</button>
199-
</div>
200-
</form>
201-
<hr />
166+
167+
<div style={{display: 'flex', flexDirection: 'column'}}>
168+
<form
169+
onSubmit={handleSubmit}
170+
style={{
171+
display: 'flex',
172+
flexDirection: 'column',
173+
alignItems: 'center',
174+
}}
175+
>
176+
<label htmlFor="pokemonName-input">Pokemon Name</label>
177+
<small>
178+
Try{' '}
179+
<InvisibleButton onClick={() => handleSelect('pikachu')}>
180+
"pikachu"
181+
</InvisibleButton>
182+
{', '}
183+
<InvisibleButton onClick={() => handleSelect('charizard')}>
184+
"charizard"
185+
</InvisibleButton>
186+
{', or '}
187+
<InvisibleButton onClick={() => handleSelect('mew')}>
188+
"mew"
189+
</InvisibleButton>
190+
</small>
191+
<div>
192+
<input
193+
id="pokemonName-input"
194+
name="pokemonName"
195+
value={pokemonName}
196+
onChange={handleChange}
197+
/>
198+
<button type="submit">Submit</button>
199+
</div>
200+
</form>
201+
<hr />
202+
<PokemonCacheProvider>
202203
<div style={{display: 'flex'}}>
203204
<PreviousPokemon onSelect={handleSelect} />
204205
<div style={{marginLeft: 10}} data-testid="pokemon-display">
205206
<PokemonInfo pokemonName={submittedPokemon} />
206207
</div>
207208
</div>
208-
</div>
209-
</PokemonCacheProvider>
209+
</PokemonCacheProvider>
210+
</div>
210211
)
211212
}
212213
Usage.title = 'useContext: Caching response data in context'

‎src/exercises/04.js‎

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -178,50 +178,51 @@ function Usage() {
178178
}
179179

180180
return (
181-
<PokemonCacheProvider>
182-
<div style={{display: 'flex', flexDirection: 'column'}}>
183-
<form
184-
onSubmit={handleSubmit}
185-
style={{
186-
display: 'flex',
187-
flexDirection: 'column',
188-
alignItems: 'center',
189-
}}
190-
>
191-
<label htmlFor="pokemonName-input">Pokemon Name</label>
192-
<small>
193-
Try{' '}
194-
<InvisibleButton onClick={() => handleSelect('pikachu')}>
195-
"pikachu"
196-
</InvisibleButton>
197-
{', '}
198-
<InvisibleButton onClick={() => handleSelect('charizard')}>
199-
"charizard"
200-
</InvisibleButton>
201-
{', or '}
202-
<InvisibleButton onClick={() => handleSelect('mew')}>
203-
"mew"
204-
</InvisibleButton>
205-
</small>
206-
<div>
207-
<input
208-
id="pokemonName-input"
209-
name="pokemonName"
210-
value={pokemonName}
211-
onChange={handleChange}
212-
/>
213-
<button type="submit">Submit</button>
214-
</div>
215-
</form>
216-
<hr />
181+
182+
<div style={{display: 'flex', flexDirection: 'column'}}>
183+
<form
184+
onSubmit={handleSubmit}
185+
style={{
186+
display: 'flex',
187+
flexDirection: 'column',
188+
alignItems: 'center',
189+
}}
190+
>
191+
<label htmlFor="pokemonName-input">Pokemon Name</label>
192+
<small>
193+
Try{' '}
194+
<InvisibleButton onClick={() => handleSelect('pikachu')}>
195+
"pikachu"
196+
</InvisibleButton>
197+
{', '}
198+
<InvisibleButton onClick={() => handleSelect('charizard')}>
199+
"charizard"
200+
</InvisibleButton>
201+
{', or '}
202+
<InvisibleButton onClick={() => handleSelect('mew')}>
203+
"mew"
204+
</InvisibleButton>
205+
</small>
206+
<div>
207+
<input
208+
id="pokemonName-input"
209+
name="pokemonName"
210+
value={pokemonName}
211+
onChange={handleChange}
212+
/>
213+
<button type="submit">Submit</button>
214+
</div>
215+
</form>
216+
<hr />
217+
<PokemonCacheProvider>
217218
<div style={{display: 'flex'}}>
218219
<PreviousPokemon onSelect={handleSelect} />
219220
<div style={{marginLeft: 10}} data-testid="pokemon-display">
220221
<PokemonInfo pokemonName={submittedPokemon} />
221222
</div>
222223
</div>
223-
</div>
224-
</PokemonCacheProvider>
224+
</PokemonCacheProvider>
225+
</div>
225226
)
226227
}
227228
Usage.title = 'useContext: Caching response data in context'

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /