import React, { useCallback, useEffect, useRef, useState } from 'react'; import dayjs from 'dayjs'; import { Link } from 'react-router-dom' import { ArrowImg, IconButton, InputElement, InputLabel, InputWrapper, StartWrapper, LessonItem, Lessonname, } from './style'; import arrow from '../assets/36-arrow-right.svg'; import { connect, getSocket } from "../socket"; export const Journal = () => { const [lessons, setLessons] = useState(null); useEffect(() => { connect(); const socket = getSocket(); socket.on('lessons', data => { setLessons(data) }) }, []); const [value, setValue] = useState(''); const handleChange = useCallback(event => { setValue(event.target.value.toUpperCase()) }, [setValue]); const inputRef = useRef(null); const handleSubmit = useCallback((event) => { event.preventDefault(); const socket = getSocket(); socket.emit('create-lesson', { lessonName: value }); setValue('') }, [value]) return (
Название новой лекции:
) };