-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Wait for 4.6] Move to Redux hooks #2364
Conversation
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'm really excited to start using these new hooks!!! Great stuff!
ping! |
a5ac145
to
fff75fa
Compare
Working on now. 😀 Good that I have commented on what areas I need to work on. 👍🏻 |
We need more samples. |
Spent a lot of time revisiting every single hook. There were stupidity but all are fixed now. Should write down my rationale and thoughts on what to hook and how, in Despite this is huge. I love this work. And I believe devs who are new to component customization will love how we design the solution. |
Couldn't believe I refactored 150 files in a single commit and I only have 2 build-time errors. No runtime errors. 💪🏻 |
4055d8f
to
38ebfbc
Compare
e4260b0
to
48b0e2b
Compare
Finally, a well-defined (and hopefully well-thought) Web Chat API. 💪🏻 For starter, please read |
Fixes #2345.
Changelog Entry
(TBD)
Description
[email protected]
finally support partitioned Redux hooks in their #1309! 🎉 It was just released the day before yesterday!Thanks for @corinagum on the BIG push of moving from class components to functional components. So we can make this push today. 💪🏻
We are also moving away from HOC and use hooks intensively. This will reduce code complexity and highly improve readability.
Now it is super easy to build a new UI component without too much reading into Web Chat code, thanks to the React hooks pattern.
For example, if you want to build a button that would open microphone.
And put this
<StartRecordingButton>
inside any part of Web Chat, it will automatically wired up.Also, the
propTypes
on the component is very clean now. No more unnecessary-but-required-by-ESLint props from the context or store.Specific Changes
use*
hook is small and we are able to shuffle the physical location of the actual function if we want to, without breaking the userconnectToWebChat()
intouseSelector(WebChatReduxContext)
anduseContext(WebChatContext)
connect*
HOC functionssamples/09.customization-reaction-buttons
samples/10.b.customization-password-input
samples/13.customization-speech-ui
samples/21.customization-plain-ui
connect*
anduse*
useComponent
(e.g.useMicrophoneButton
), we no longer exposelanguage
import { useActivities } from 'botframework-webchat-component/lib/hooks
, and not exposing it at the root level(Optional) Might be a good idea to understand more about the performance gain(Optional) Experiment on how to add a new UI component to Web Chat in the new world10.b.customization-password-input
and21.customization-plain-ui
are two great ways to explore the world of hooks