Skip to content

Commit ad4bdc1

Browse files
committed
add object prop memoize guide
1 parent 9284fff commit ad4bdc1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

CHANGELOG.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
The 3rd parameter customData to the `sdk.addSendbirdExtension` function, allowing it to be delivered from outside of UIKit React.
77
e.g.
88
```
9+
// its recommended to memoize customExtensionParams
10+
const memoizedCustomExtensionParams = useRef({
11+
// the key-value sets will be passed when sdk.addSendbirdExtensions is called
12+
...
13+
})
914
<SendbirdProvider
10-
customExtensionParams={{
11-
a: 'a', // the key-value set will be passed when sdk.addSendbirdExtensions is called
12-
}}
15+
customExtensionParams={memoizedCustomExtensionParams.current}
1316
/>
1417
```
1518
* Call `sdk.addSendbirdExtensions` during the connection process (#682)
@@ -29,12 +32,14 @@
2932

3033
e.g.
3134
```
35+
// its recommended to memoize sdkInitParams
36+
const memoizedSdkInitParams = useRef({
37+
appStateToggleEnabled: false,
38+
debugMode: true,
39+
// more options can be found here https://sendbird.com/docs/chat/v4/javascript/ref/interfaces/_sendbird_chat.SendbirdChatParams.html
40+
})
3241
<SendbirdProvider
33-
sdkInitParams={{
34-
appStateToggleEnabled: false,
35-
debugMode: true,
36-
// more options can be found here https://sendbird.com/docs/chat/v4/javascript/ref/interfaces/_sendbird_chat.SendbirdChatParams.html
37-
}}
42+
sdkInitParams={memoizedSdkInitParams.current}
3843
/>
3944
```
4045

0 commit comments

Comments
 (0)