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

Create a debug/trace facility #2

Open
yuchi opened this issue Nov 29, 2018 · 0 comments
Open

Create a debug/trace facility #2

yuchi opened this issue Nov 29, 2018 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@yuchi
Copy link
Owner

yuchi commented Nov 29, 2018

Since this is a macro, there’s little to no way to trace which references are placed in the inputs array.

An initial proposal syntax could be this:

function MyComponent() {
  const { magnitude } = props;
  const [counter, setCounter] = useState();
  const handleClick = useAutoCallback(event => {
    setCounter(counter * magnitude);
  }, trace);
  // ↑↑↑↑↑
}

Which would output (on every render):

MyComponent › handleClick › useAutoCallback inputs: { counter: 0, magnitude: 4 }
  ┬             ┬             ┬                       ─┬──────────────────────
  │             │             │                        │
  │             │             └─ name of the macro     └─ identifier name and
  │             │                                         value for each input
  │             │
  │             └─ eventual name of the resulting variable
  └─ name of the outer significant scope
@yuchi yuchi added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant