Skip to content

5h Solution #14

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

Open
wants to merge 1 commit into
base: 5h
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion 2-copy-of-code/lesson-05/chatbot-project/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState } from 'react'
import { useState, useEffect } from 'react'
import { Chatbot } from 'supersimpledev';
import { ChatInput } from './components/ChatInput';
import ChatMessages from './components/ChatMessages';
import './App.css'
Expand All @@ -25,6 +26,19 @@ function App() {
// const chatMessages = array[0];
// const setChatMessages = array[1];

useEffect(() => {
Chatbot.addResponses({
'goodbye': 'Goodbye. Have a great day!',
'give me a unique id': function() {
return `Sure! Here's a unique ID: ${crypto.randomUUID()}`;
}
});

// [] tells useEffect to only run once. We only want to run
// this setup code once because we only want to add these
// extra responses once.
}, []);

return (
<div className="app-container">
<ChatMessages
Expand Down