samdenty/console-feed

Reverse log display order possible?

TenaciousTechnologistExtraordinaire opened this issue · 1 comments

Hello, I have your plugin partially working, but I have to increase my y resolution to ludicrous 32,000 pixels so I can scroll all the way down to the bottom to see the latest log entries. Is there a way to reverse the order of the log entries so that the newest logs show on top instead of at the bottom:

`import React, { useState, useEffect } from 'react'
import { Console, Hook, Unhook } from 'console-feed'
import * as Demo from "./demo";

const LogsContainer = () => {
const [logs, setLogs] = useState([])
// run once!
useEffect(() => {
Hook(
window.console,
(log) => setLogs((currLogs) => [...currLogs, log]),
false
)

return () => Unhook(window.console)

}, [])

return
}

export default LogsContainer`

Maybe it's too long after, but this seems pretty straightforward.
Just change

(log) => setLogs((currLogs) => [...currLogs, log]),

to

(log) => setLogs((currLogs) => [log, ...currLogs]),