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.

Expose imperative API

See original GitHub issue

Expose an imperative API for manipulating queries from outside the component.

There are several options for API design:

  1. Hooks (useQueryBuilder?). Not sure how that would connect with a specific <QueryBuilder /> instance, in case there were multiple being rendered.
  2. Refs. Might have to wrap the main component with forwardRef(), but maybe not. See react-select implementation of focus() and blur() methods.
  3. Callback that provides an api parameter, a la AG Grid. This would probably be the easiest to implement.

@zukilover, since you gave me the idea, do you have any preference among the API design choices?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zukilovercommented, Dec 3, 2021

While callback is the easiest one, the original purpose of the request was really to enhance controlElements, so that we could rearrange the interfaces as much as we like. With that in mind, I think refs is the most elegant way of doing it.

0reactions
jakeboone02commented, Dec 20, 2021

Yeah, it’s probably better to wait to address this until after 4.0 is released, anyway. Lots of churn in the codebase at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Managing Kubernetes Objects Using Imperative Commands
Kubernetes objects can quickly be created, updated, and deleted directly using imperative commands built into the kubectl command-line tool.
Read more >
API Imperative: From IT Concern to Business Mandate - WSJ
The API imperative—the strategic deployment of application programming interfaces to facilitate self-service publishing and consumption of ...
Read more >
Integrating imperative APIs into a React application
A component that wraps an imperative API with a declarative facade should be capable of translating changes in input into the correct sequence ......
Read more >
Expose native imperative API · Issue #1819 - GitHub
Might have to update Java to keep some MediaPlayer state information around to handle .play and .pause being called on a MediaPlayer instance ......
Read more >
Why Kubernetes REST API is imperative? - Stack Overflow
The Kubernetes API is declarative in the sense that you always specify what you want, e.g. replicas: 2 instead of e.g. create 2...
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