Skip to content

Commit d7a8d61

Browse files
authored
.md file cleanup (#2577)
1 parent 0b7e6e0 commit d7a8d61

2 files changed

Lines changed: 98 additions & 100 deletions

File tree

HOOKS.md

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Web Chat expose our APIs through React Hooks. This API surface enables us to fre
1414

1515
We design our hooks largely with two basic shapes:
1616

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
2121

2222
### Actions
2323

@@ -36,7 +36,7 @@ All properties follow [React State Hook pattern](https://reactjs.org/docs/hooks-
3636
```js
3737
const [sendBoxValue, setSendBoxValue] = useSendBoxValue();
3838

39-
console.log(`The send box value is "${ sendBoxValue }".`);
39+
console.log(`The send box value is "${sendBoxValue}".`);
4040

4141
setSendBoxValue('Hello, World!');
4242
```
@@ -47,49 +47,49 @@ setSendBoxValue('Hello, World!');
4747

4848
Following is the list of hooks supported by Web Chat API.
4949

50-
- [`useActivities`](#useactivities)
51-
- [`useAdaptiveCardsHostConfig`](#useadaptivecardshostconfig)
52-
- [`useAdaptiveCardsPackage`](#useadaptivecardspackage)
53-
- [`useAvatarForBot`](#useavatarforbot)
54-
- [`useAvatarForUser`](#useavatarforuser)
55-
- [`useConnectivityStatus`](#useconnectivitystatus)
56-
- [`useDictateInterims`](#usedictateinterims)
57-
- [`useDictateState`](#usedictatestate)
58-
- [`useDisabled`](#usedisabled)
59-
- [`useEmitTypingIndicator`](#useemittypingindicator)
60-
- [`useFocusSendBox`](#usefocussendbox)
61-
- [`useGrammars`](#usegrammars)
62-
- [`useGroupTimestamp`](#usegrouptimestamp)
63-
- [`useLanguage`](#uselanguage)
64-
- [`useLastTypingAt`](#uselasttypingat)
65-
- [`useLocalize`](#uselocalize)
66-
- [`useMarkActivityAsSpoken`](#usemarkactivityasspoken)
67-
- [`usePerformCardAction`](#useperformcardaction)
68-
- [`usePostActivity`](#usepostactivity)
69-
- [`useReferenceGrammarID`](#usereferencegrammarid)
70-
- [`useRenderActivity`](#useRenderActivity)
71-
- [`useRenderAttachment`](#useRenderAttachment)
72-
- [`useRenderMarkdownAsHTML`](#useRenderMarkdownAsHTML)
73-
- [`useScrollToEnd`](#usescrolltoend)
74-
- [`useSendBoxValue`](#usesendboxvalue)
75-
- [`useSendEvent`](#usesendevent)
76-
- [`useSendFiles`](#usesendfiles)
77-
- [`useSendMessage`](#usesendmessage)
78-
- [`useSendMessageBack`](#usesendmessageback)
79-
- [`useSendPostBack`](#usesendpostback)
80-
- [`useSendTypingIndicator`](#usesendtypingindicator)
81-
- [`useShouldSpeakIncomingActivity`](#useshouldspeakincomingactivity)
82-
- [`useStartDictate`](#usestartdictate)
83-
- [`useStopDictate`](#usestopdictate)
84-
- [`useStyleOptions`](#usestyleoptions)
85-
- [`useStyleSet`](#usestyleset)
86-
- [`useSubmitSendBox`](#usesubmitsendbox)
87-
- [`useSuggestedActions`](#usesuggestedactions)
88-
- [`useTimeoutForSend`](#usetimeoutforsend)
89-
- [`useUserID`](#useuserid)
90-
- [`useUsername`](#useusername)
91-
- [`useVoiceSelector`](#usevoiceselector)
92-
- [`useWebSpeechPonyfill`](#usewebspeechponyfill)
50+
- [`useActivities`](#useactivities)
51+
- [`useAdaptiveCardsHostConfig`](#useadaptivecardshostconfig)
52+
- [`useAdaptiveCardsPackage`](#useadaptivecardspackage)
53+
- [`useAvatarForBot`](#useavatarforbot)
54+
- [`useAvatarForUser`](#useavatarforuser)
55+
- [`useConnectivityStatus`](#useconnectivitystatus)
56+
- [`useDictateInterims`](#usedictateinterims)
57+
- [`useDictateState`](#usedictatestate)
58+
- [`useDisabled`](#usedisabled)
59+
- [`useEmitTypingIndicator`](#useemittypingindicator)
60+
- [`useFocusSendBox`](#usefocussendbox)
61+
- [`useGrammars`](#usegrammars)
62+
- [`useGroupTimestamp`](#usegrouptimestamp)
63+
- [`useLanguage`](#uselanguage)
64+
- [`useLastTypingAt`](#uselasttypingat)
65+
- [`useLocalize`](#uselocalize)
66+
- [`useMarkActivityAsSpoken`](#usemarkactivityasspoken)
67+
- [`usePerformCardAction`](#useperformcardaction)
68+
- [`usePostActivity`](#usepostactivity)
69+
- [`useReferenceGrammarID`](#usereferencegrammarid)
70+
- [`useRenderActivity`](#useRenderActivity)
71+
- [`useRenderAttachment`](#useRenderAttachment)
72+
- [`useRenderMarkdownAsHTML`](#useRenderMarkdownAsHTML)
73+
- [`useScrollToEnd`](#usescrolltoend)
74+
- [`useSendBoxValue`](#usesendboxvalue)
75+
- [`useSendEvent`](#usesendevent)
76+
- [`useSendFiles`](#usesendfiles)
77+
- [`useSendMessage`](#usesendmessage)
78+
- [`useSendMessageBack`](#usesendmessageback)
79+
- [`useSendPostBack`](#usesendpostback)
80+
- [`useSendTypingIndicator`](#usesendtypingindicator)
81+
- [`useShouldSpeakIncomingActivity`](#useshouldspeakincomingactivity)
82+
- [`useStartDictate`](#usestartdictate)
83+
- [`useStopDictate`](#usestopdictate)
84+
- [`useStyleOptions`](#usestyleoptions)
85+
- [`useStyleSet`](#usestyleset)
86+
- [`useSubmitSendBox`](#usesubmitsendbox)
87+
- [`useSuggestedActions`](#usesuggestedactions)
88+
- [`useTimeoutForSend`](#usetimeoutforsend)
89+
- [`useUserID`](#useuserid)
90+
- [`useUsername`](#useusername)
91+
- [`useVoiceSelector`](#usevoiceselector)
92+
- [`useWebSpeechPonyfill`](#usewebspeechponyfill)
9393

9494
## `useActivities`
9595

@@ -153,14 +153,14 @@ useConnectivityStatus(): [string]
153153

154154
This function will return the connectivity status of:
155155

156-
- `connected`: Connected
157-
- `connectingslow`: Still connecting, not connected
158-
- `error`: Connection error
159-
- `notconnected`: Not connected
160-
- `reconnected`: Reconnected after interruption
161-
- `reconnecting`: Reconnecting after interruption
162-
- `sagaerror`: Errors on JavaScript side
163-
- `uninitialized`: Never connect and not connecting
156+
- `connected`: Connected
157+
- `connectingslow`: Still connecting, not connected
158+
- `error`: Connection error
159+
- `notconnected`: Not connected
160+
- `reconnected`: Reconnected after interruption
161+
- `reconnecting`: Reconnecting after interruption
162+
- `sagaerror`: Errors on JavaScript side
163+
- `uninitialized`: Never connect and not connecting
164164

165165
## `useDictateInterims`
166166

@@ -180,10 +180,10 @@ useDictateState(): [string]
180180

181181
This function will return the dictate state of:
182182

183-
- `0`: Idle
184-
- `1`: Starting
185-
- `2`: Dictating
186-
- `3`: Stopping
183+
- `0`: Idle
184+
- `1`: Starting
185+
- `2`: Dictating
186+
- `3`: Stopping
187187

188188
To control dictate state, use [`useStartDictate`](#usestartdictate) and [`useStopDictate`](#usestopdictate) hooks.
189189

@@ -298,9 +298,9 @@ When called, this function will post the activity on behalf of the user, to the
298298

299299
You can use this function to send any type of activities to the bot, but we highly recommend you send the following type of activities only:
300300

301-
- `event`
302-
- `message`
303-
- `typing`
301+
- `event`
302+
- `message`
303+
- `typing`
304304

305305
## `useReferenceGrammarID`
306306

@@ -390,8 +390,8 @@ useSendFiles(): (files: (Blob | File)[]) => void
390390

391391
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:
392392

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
395395

396396
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).
397397

@@ -560,8 +560,8 @@ These are hooks specific provide specific user experience.
560560

561561
These are hooks that are specific for the microphone button.
562562

563-
- [`useMicrophoneButtonClick`](#usemicrophonebuttonclick)
564-
- [`useMicrophoneButtonDisabled`](#usemicrophonebuttondisabled)
563+
- [`useMicrophoneButtonClick`](#usemicrophonebuttonclick)
564+
- [`useMicrophoneButtonDisabled`](#usemicrophonebuttondisabled)
565565

566566
### `useMicrophoneButtonClick`
567567

@@ -585,7 +585,7 @@ This value can be partly controllable through Web Chat props.
585585

586586
These are hooks that are specific for the send box.
587587

588-
- [`useSendBoxDictationStarted`](#usesendboxdictationstarted)
588+
- [`useSendBoxDictationStarted`](#usesendboxdictationstarted)
589589

590590
### `useSendBoxDictationStarted`
591591

@@ -599,8 +599,8 @@ This function will return whether the speech-to-text has been started or not.
599599

600600
These are hooks that are specific to the text box in the send box.
601601

602-
- [`useTextBoxSubmit`](#usetextboxsubmit)
603-
- [`useTextBoxValue`](#usetextboxvalue)
602+
- [`useTextBoxSubmit`](#usetextboxsubmit)
603+
- [`useTextBoxValue`](#usetextboxvalue)
604604

605605
### `useTextBoxSubmit`
606606

@@ -626,7 +626,7 @@ The setter function will call the setter of [`useSendBoxValue`](#usesendboxvalue
626626

627627
These are hooks that are specific to the typing indicator.
628628

629-
- [`useTypingIndicatorVisible`](#usetypingindicatorvisible)
629+
- [`useTypingIndicatorVisible`](#usetypingindicatorvisible)
630630

631631
### `useTypingIndicatorVisible`
632632

@@ -638,5 +638,5 @@ This function will return whether the typing indicator should be visible or not.
638638

639639
This function derives the visibility of the typing indicator by:
640640

641-
- `typingAnimationDuration` value specified in style options, in milliseconds
642-
- Values from the `useLastTypingAt` hook
641+
- `typingAnimationDuration` value specified in style options, in milliseconds
642+
- Values from the `useLastTypingAt` hook

samples/23.a.hybrid-react-npm/README.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ To run this sample, follow steps below:
2121

2222
There are two packages in this [monorepo](https://en.wikipedia.org/wiki/Monorepo):
2323

24-
- `app`: the hosting app, created using [`create-react-app`](https://github.com/facebook/create-react-app)
25-
26-
- `chat-component`: the chat component, which will render Web Chat
27-
24+
- `app`: the hosting app, created using [`create-react-app`](https://github.com/facebook/create-react-app)
25+
26+
- `chat-component`: the chat component, which will render Web Chat
27+
2828

2929
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.
3030

@@ -38,9 +38,9 @@ In `chat-component` package, we created an entrypoint for rendering a React comp
3838
import { render, unmountComponentAtNode } from 'react-dom';
3939

4040
function renderChatComponent(props, node) {
41-
render(<ChatComponent {...props} />, node);
41+
render(<ChatComponent {...props} />, node);
4242

43-
return () => unmountComponentAtNode(node);
43+
return () => unmountComponentAtNode(node);
4444
}
4545
```
4646

@@ -52,17 +52,15 @@ In the host application, we created a new component called `<ChatComponentWrappe
5252

5353
```jsx
5454
class ChatComponentWrapper extends React.Component {
55-
constructor(props) {
56-
super(props);
55+
constructor(props) {
56+
super(props);
5757

58-
this.saveChatComponentRef = ref => this.chatComponentRef = ref;
59-
}
58+
this.saveChatComponentRef = ref => (this.chatComponentRef = ref);
59+
}
6060

61-
render() {
62-
return (
63-
<div ref={ this.saveChatComponentRef } />
64-
);
65-
}
61+
render() {
62+
return <div ref={this.saveChatComponentRef} />;
63+
}
6664
}
6765
```
6866

@@ -147,18 +145,18 @@ In this approach, we isolated the DOM element from the React DOM tree. Then we u
147145

148146
There are several key limitations to this approach:
149147

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
158156

159157
# Further reading
160158

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)
164-
- [React: Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html)
159+
- [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)
162+
- [React: Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html)

0 commit comments

Comments
 (0)