Skip to content
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

Reverse log display order possible? #107

Open
TenaciousTechnologistExtraordinaire opened this issue Jul 14, 2022 · 1 comment
Open

Reverse log display order possible? #107

TenaciousTechnologistExtraordinaire opened this issue Jul 14, 2022 · 1 comment

Comments

@TenaciousTechnologistExtraordinaire

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`

@implicit-invocation
Copy link

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

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

to

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants