Posts

  import { useState, useRef, useEffect } from "react"; export default function App() { const [messages, setMessages] = useState([ { sender: "bot", text: "Hello! How can I assist you today?" }, ]); const [input, setInput] = useState(""); const [isTyping, setIsTyping] = useState(false); const messagesEndRef = useRef(null); const scrollToBottom = () => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); }; useEffect(() => { scrollToBottom(); }, [messages]); const handleSend = () => { if (!input.trim()) return; const userMessage = { sender: "user", text: input }; setMessages((prev) => [...prev, userMessage]); setInput(""); setIsTyping(true); // Simulate bot response after delay setTimeout(() => { const responses = [ "That's an interesting question!", "Let me think about...
import { useState, useRef, useEffect } from "react"; export default function App() { const [messages, setMessages] = useState([ { sender: "bot", text: "Hello! How can I assist you today?" }, ]); const [input, setInput] = useState(""); const [isTyping, setIsTyping] = useState(false); const messagesEndRef = useRef(null); const scrollToBottom = () => { messagesEndRef.current?.scrollIntoView({ behavior: "smooth" }); }; useEffect(() => { scrollToBottom(); }, [messages]); const handleSend = () => { if (!input.trim()) return; const userMessage = { sender: "user", text: input }; setMessages((prev) => [...prev, userMessage]); setInput(""); setIsTyping(true); // Simulate bot response after delay setTimeout(() => { const responses = [ "That's an interesting question!", "Let me think about that...", ...
Image
YakshaScans Clone - Manga Reader YakshaManga Home Manga Genres Login Read Your Favorite Manga Explore thousands of manga titles updated daily. Popular Manga Updates {Array.from({ length: 10 }).map((_, i) => ( Manga Title {i + 1} Chapter {Math.floor(Math.random() * 100)} Updated 2 hours ago ))} Latest Manga Updates {Array.from({ length: 10 }).map((_, i) => ( New Title {i + 1} Chapter {Math.floor(Math.random() * 50)} Updated just now ))} Lost your password? Please enter your username or email address. You will r...