Files
supabase/examples/nextjs-live-tracker-map/components/TextLog.js
2021-05-22 02:30:29 +00:00

22 lines
411 B
JavaScript

import { useEffect, useRef } from 'react'
export default function TextLog({ log }) {
const textLog = useRef(null)
useEffect(() => {
textLog.current.scrollTop = textLog.current.scrollHeight
}, [log])
return (
<>
<textarea ref={textLog} readOnly value={log} />
<style jsx>{`
textarea {
width: 100%;
height: 7rem;
}
`}</style>
</>
)
}