You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From an implementation standpoint, I believe we'd be wrapping our components somewhat like this:
// Assume a single driver was created when we initialized Search UI
// Grab relevant data and actions from the driver state and render the component
const searchTerm = driver.state.searchTerm;
const setSearchTerm = driver.actions.setSearchTerm;
const element = document.getElementById("#search-box"));
ReactDOM.render(<SearchBox searchTerm={searchTerm} setSearchTerm={setSearchTerm} />, element);
// Any time a user interacts with a component it will trigger an action, which triggers a state update in the driver, which we'll handle by re-rendering with the updated state.
driver.subscribeToStateChanges(state => {
ReactDOM.render(<SearchBox searchTerm={state.searchTerm} setSearchTerm={setSearchTerm} />, element);
})
The text was updated successfully, but these errors were encountered:
I have no idea of the viability of this, but it could be worthwhile looking into https://preactjs.com/, which has a smaller size than React, for bundling w/ search-ui. Upside could be some KB saved, downside could be preact-specific bugs that would surface in this bundled version. Their goal is 1:1 parity with React using he same API (they just added hooks! preactjs/preact#1247 (comment))
Edit: Found some prior art, Uppy decided to use Preact over React for their distributed file uploader components! https://uppy.io/blog/2017/12/0.22/
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Is this issue still important to you? If so, please leave a comment and let us know. As always, thank you for your contributions.
The React version of Search UI requires the following:
A Web Based version of Search UI would effectively be a wrapper around the React version, that you could include directly via a script tag.
search-ui.js
bundle.So for example, on a web page, if you simply wanted to use a search-ui autocomplete search box, you could do so easily, with minimal configuration:
From an implementation standpoint, I believe we'd be wrapping our components somewhat like this:
The text was updated successfully, but these errors were encountered: