Comments (4)
Oh, also, I'm currently getting into an infinite loop in the Suspense stuff.
Here's the block of code that's triggering the infinite loop in the test:
modern-react/src/__tests__/11.js
Lines 28 to 33 in 5b2e232
If you make this return Promise.reject()
then you can reproduce the infinite loop in the app:
modern-react/src/fetch-pokemon.js
Line 2 in 5b2e232
Help there would be super appreciated :)
Here's the code for where that's all happening: https://github.com/kentcdodds/modern-react/blob/master/src/exercises-final/11.js
(Note: I do plan to teach and recommend react-cache
(see 12, 13, and 14), I just like to start as simple as possible so people understand what's going on fundamentally).
from modern-react.
Oh, and exercise 15 doesn't work yet because you can't currently use Hooks in React.pure
. @acdlite mentioned that's an oversight and will be fixed, either way a review of that is appreciated as well :)
from modern-react.
11.js: You probably want to cache the promise so you don't ever do two fetches for the same name. Would the error boundary and placeholder be better in Usage? Generally people err on the side of coupling Placeholders too tightly with individual fetches and we want to discourage that.
12.js/13.js: Best practices on passing down a cache are TBD and might change in the next two weeks.
14.js: Maybe teach React.lazy before other types of suspense? It's easier to wrap your head around I think.
from modern-react.
All great tips @sophiebits! Thank you!
from modern-react.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modern-react.