-
Notifications
You must be signed in to change notification settings - Fork 86
docs(recipes/making-an-api-call): update #387
Conversation
📊 Bundle Size Report
|
272a6d0
to
e47d818
Compare
docs/recipes/Module-Composition.md
Outdated
const ParentModule = () => ( | ||
<div> | ||
<h1>I am the parent module</h1> | ||
<RenderModule moduleName="ChildModule" props={{ greeting: 'hello' }} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to encourage the convention of kebab-case for module names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/recipes/Module-Composition.md
Outdated
``` | ||
|
||
To use RenderModule we need to ensure that the module bundle has been correctly | ||
loaded into our client or server before it can be rendered. We can do this by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All server bundles are already stored in memory. On the server it's only the module's data we would need to load.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true true
Co-authored-by: Ruben Casas <ruben@infoxication.net>
docs/recipes/Making-An-Api-Call.md
Outdated
} | ||
}; | ||
fetchBooks(); | ||
}, [id]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is id
coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah missed that
Co-authored-by: Mike Tobia <Francois-Esquire@users.noreply.github.com>
}; | ||
|
||
Books.holocron = { | ||
// Runs on both Server and Browser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Runs on both Server and Browser | |
// Runs on both Server and Browser. Use global.BROWSER to alternate between the two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think in this context that could be confusing
}; | ||
``` | ||
|
||
The modules reducer would handle those dispatched actions so the module would be able to retrieve the data from the Redux store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modules reducer would handle those dispatched actions so the module would be able to retrieve the data from the Redux store. | |
The modules reducer would handle those dispatched actions so the module would be able to retrieve the data from the Redux store. Depending on your case this value is not mandatory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to fetch this on the server and have the data propagate to the ui using the reducer would be required
const { isLoading, data, error } = useFetchye('https://some-data-server.com/api/v1/books'); | ||
const books = data && data.body; | ||
|
||
if (isLoading) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also advice using data.body.status===200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could add a check for data.ok
but that is something i expect an engineer to handle, this is just a basic example of the fetchye api
Co-authored-by: Nelly Kiboi <nelly.j.kiboi@aexp.com>
42e44c8
Description
Motivation and Context
How Has This Been Tested?
Types of Changes
Checklist:
What is the Impact to Developers Using One App?