You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: HOOKS.md
+73-73Lines changed: 73 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,10 +14,10 @@ Web Chat expose our APIs through React Hooks. This API surface enables us to fre
14
14
15
15
We design our hooks largely with two basic shapes:
16
16
17
-
- Actions, these are functions that you can call at any time to perform a side-effect
18
-
- Properties, these are getter function with an optional setter
19
-
- This is same as [React State Hook pattern](https://reactjs.org/docs/hooks-state.html), but setters are optional
20
-
- If the value is changed, React will call your render function again
17
+
-Actions, these are functions that you can call at any time to perform a side-effect
18
+
-Properties, these are getter function with an optional setter
19
+
-This is same as [React State Hook pattern](https://reactjs.org/docs/hooks-state.html), but setters are optional
20
+
-If the value is changed, React will call your render function again
21
21
22
22
### Actions
23
23
@@ -36,7 +36,7 @@ All properties follow [React State Hook pattern](https://reactjs.org/docs/hooks-
When called, this function will send a message activity with one or more [File](https://developer.mozilla.org/en-US/docs/Web/API/File) attachments to the bot, including these operations:
392
392
393
-
- Convert [File](https://developer.mozilla.org/en-US/docs/Web/API/File) into object URL
394
-
- Generate thumbnail and will use a Web Worker and a offscreen canvas if supported
393
+
-Convert [File](https://developer.mozilla.org/en-US/docs/Web/API/File) into object URL
394
+
-Generate thumbnail and will use a Web Worker and a offscreen canvas if supported
395
395
396
396
If you are using an `ArrayBuffer`, you can use `FileReader` to convert it into a blob before calling [`URL.createObjectURL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL).
397
397
@@ -560,8 +560,8 @@ These are hooks specific provide specific user experience.
560
560
561
561
These are hooks that are specific for the microphone button.
Copy file name to clipboardExpand all lines: samples/23.a.hybrid-react-npm/README.md
+25-27Lines changed: 25 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,10 @@ To run this sample, follow steps below:
21
21
22
22
There are two packages in this [monorepo](https://en.wikipedia.org/wiki/Monorepo):
23
23
24
-
-`app`: the hosting app, created using [`create-react-app`](https://github.com/facebook/create-react-app)
-`app`: the hosting app, created using [`create-react-app`](https://github.com/facebook/create-react-app)
The hosting app will create an [isolated DOM element](https://reactjs.org/docs/integrating-with-other-libraries.html) and pass it to the `chat-component` package. The chat component will control the rendering of the DOM element, while the hosting app controls the lifetime.
30
30
@@ -38,9 +38,9 @@ In `chat-component` package, we created an entrypoint for rendering a React comp
@@ -147,18 +145,18 @@ In this approach, we isolated the DOM element from the React DOM tree. Then we u
147
145
148
146
There are several key limitations to this approach:
149
147
150
-
- Increased memory usage and bundle size
151
-
- Only `props` can be passed between two DOM trees; React Context cannot be passed between them without extra work
152
-
- It is doable, but will require two different context objects and they must be wired up manually
153
-
- This includes `<Provider>` and `connect()` HOC in `react-redux`
154
-
-[React-based customizations](https://github.com/microsoft/botframework-webchat#customize-web-chat-ui) added to Web Chat will still require React 16.8.6 or up
155
-
- For example, activity and attachment middleware require the newer version of React
156
-
- Introducing new package(s), which could increase unnecessary fragmentation in your codebase
157
-
- The rendering processes between two DOM trees are asynchronous and not guaranteed to complete at the same time
148
+
-Increased memory usage and bundle size
149
+
-Only `props` can be passed between two DOM trees; React Context cannot be passed between them without extra work
150
+
-It is doable, but will require two different context objects and they must be wired up manually
151
+
-This includes `<Provider>` and `connect()` HOC in `react-redux`
152
+
-[React-based customizations](https://github.com/microsoft/botframework-webchat#customize-web-chat-ui) added to Web Chat will still require React 16.8.6 or up
153
+
-For example, activity and attachment middleware require the newer version of React
154
+
-Introducing new package(s), which could increase unnecessary fragmentation in your codebase
155
+
-The rendering processes between two DOM trees are asynchronous and not guaranteed to complete at the same time
158
156
159
157
# Further reading
160
158
161
-
-[Web Chat: Customize Web Chat UI](https://github.com/microsoft/botframework-webchat#customize-web-chat-ui)
162
-
-[React: Rules of Hooks](https://reactjs.org/docs/hooks-rules.html)
163
-
-[React: Integrating with Other Libraries](https://reactjs.org/docs/integrating-with-other-libraries.html)
-[Web Chat: Customize Web Chat UI](https://github.com/microsoft/botframework-webchat#customize-web-chat-ui)
160
+
-[React: Rules of Hooks](https://reactjs.org/docs/hooks-rules.html)
161
+
-[React: Integrating with Other Libraries](https://reactjs.org/docs/integrating-with-other-libraries.html)
0 commit comments