Created
April 24, 2021 11:49
-
-
Save FredrikOseberg/e7cf680241fadc5fe9ff765df78f272f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActionProvider { | |
// The action provider receives createChatBotMessage which you can use to define the bots response, and | |
// the setState function that allows for manipulating the bots internal state. | |
constructor(createChatBotMessage, setStateFunc, createClientMessage) { | |
this.createChatBotMessage = createChatBotMessage; | |
this.setState = setStateFunc; | |
this.createClientMessage = createClientMessage | |
} | |
reset = () => { | |
this.setState(prev => ({ ...prev, messages: [this.createChatbotMessage("Hi")] })) | |
} | |
export default ActionProvider; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I extend the ActionProvider class to another class to use it many times?
Here's the code that I'm working on, but still I get an error.
import ActionProvider from "./ActionProvider";
class ResponseProvider extends ActionProvider {
}
export default ResponseProvider;