[Wait for 4.6] Move to Redux hooks#2364
Conversation
tdurnford
left a comment
There was a problem hiding this comment.
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
propTypeson 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-buttonssamples/10.b.customization-password-inputsamples/13.customization-speech-uisamples/21.customization-plain-uiconnect*anduse*useComponent(e.g.useMicrophoneButton), we no longer exposelanguageimport { 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-inputand21.customization-plain-uiare two great ways to explore the world of hooks