question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

logging hooks for actions and state

See original GitHub issue

In development I want to hook into choo to log all actions as they happen, and having access to state so I can bind it to window.state - it would make debugging a lot better

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
timwiscommented, Jun 26, 2016

Forgot to say thanks for the background!

1reaction
yoshuawuytscommented, May 24, 2016

Think all that’s needed is a * operator in effects. E.g.

const app = choo()
app.model({
  effects: {
    '*': function (state, action) {
      window.state = state
      console.log(action.type, action)
    }
  }
})

For toggling can wrap in an if (window.debug) inside the effect

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using React Hooks for state management - LogRocket Blog
The useReducer Hook allows you to update parts of your React component's state when certain actions are dispatched.
Read more >
How To Manage State with Hooks on React Components
In this step, you'll set the initial state on a component by assigning the initial state to a custom variable using the useState...
Read more >
How to manage state in a React app with just Context and ...
The useReducer hook returns two parameters, state and dispatch . state contains the state that is used in the component and it is...
Read more >
Redux Logger—Your Next Debugging Tool (The Art of Logging)
It's an extension that tracks the application's state changes. You can trace, jump, skip any action that has been dispatched. It's good for...
Read more >
LogRocket/redux-logger - GitHub
Instead of guessing why errors happen, or asking users for screenshots and log dumps, LogRocket lets you replay Redux actions + state, network...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found