File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ const IUseApi = ({ value = "" }) => {
175175 Last message : <strong >{hi }< / strong >
176176 < button
177177 onClick = {() =>
178- api(" say.hi" , { who : " browser- react" }).then(({ hi }) => setHi (hi ))
178+ api(" say.hi" , { who : " react-browser " }).then(({ hi }) => setHi (hi ))
179179 }
180180 >
181181 say hi
@@ -218,24 +218,26 @@ export const handler = async (context: KoaContext) => {
218218 actions ,
219219 context
220220 });
221+ const hi = (await api (" say.hi" , { who: " react-node" })).hi ;
221222 const APP_STATE: AppState = {
222223 api: {
223224 endpoint: " /api" ,
224225 headers: {
225226 " X-Secret-Foo" : " Bar"
226227 }
227228 },
228- hi: ( await api ( " say.hi " , { who: " react-node " })). hi
229+ hi
229230 };
230231 context .body = ` <!doctype html>
231232<html>
232233 <head>
233- <title></title>
234+ <title>Example </title>
234235 </head>
235236 <body>
236237 <div id="app">${ReactDOM .renderToString (
237238 React .createElement (App , {
238- api
239+ api ,
240+ hiFromServer: hi
239241 })
240242 )}</div>
241243 <script>APP_STATE=${JSON .stringify (APP_STATE )};</script>
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const IUseApi = ({ value = "" }) => {
1010 Last message: < strong > { hi } </ strong >
1111 < button
1212 onClick = { ( ) =>
13- api ( "say.hi" , { who : "browser- react" } ) . then ( ( { hi } ) => setHi ( hi ) )
13+ api ( "say.hi" , { who : "react-browser " } ) . then ( ( { hi } ) => setHi ( hi ) )
1414 }
1515 >
1616 say hi
Original file line number Diff line number Diff line change @@ -12,24 +12,26 @@ export const handler = async (context: KoaContext) => {
1212 actions,
1313 context
1414 } ) ;
15+ const hi = ( await api ( "say.hi" , { who : "react-node" } ) ) . hi ;
1516 const APP_STATE : AppState = {
1617 api : {
1718 endpoint : "/api" ,
1819 headers : {
1920 "X-Secret-Foo" : "Bar"
2021 }
2122 } ,
22- hi : ( await api ( "say.hi" , { who : "react-node" } ) ) . hi
23+ hi
2324 } ;
2425 context . body = `<!doctype html>
2526<html>
2627 <head>
27- <title></title>
28+ <title>Example </title>
2829 </head>
2930 <body>
3031 <div id="app">${ ReactDOM . renderToString (
3132 React . createElement ( App , {
32- api
33+ api,
34+ hiFromServer : hi
3335 } )
3436 ) } </div>
3537 <script>APP_STATE=${ JSON . stringify ( APP_STATE ) } ;</script>
You can’t perform that action at this time.
0 commit comments