Coder Social home page Coder Social logo

Comments (5)

SavvyShah avatar SavvyShah commented on June 2, 2024 1

Yes. You're right. Generally, you don't have to use both of them in your use-case.

URLParams are updated by the library internally. For non-custom components it's value is determined by the value of the filter which is managed by the library. Since in a custom component(filter created using ReactiveComponent), we own the value of filter, we render the options and determine how user interacts with them. Hence, we call setQuery passing the value of the filter.

If you want to change query dynamically using the custom component you created you should use setQuery provided as props in the component which would sync with the URLParams.

However if you want to update the dependent component without user interacting with your component, like selecting a value, then you should use customQuery. Here there is no way for the library to know the value of filter unless you explicitly set. One use case is mentioned in the documentation.

from reactivesearch.

rgb-panda avatar rgb-panda commented on June 2, 2024

Another issue that would prevent me from using setQuery is that it doesnt support highlight

from reactivesearch.

rgb-panda avatar rgb-panda commented on June 2, 2024

Hello @SavvyShah any comments regarding this issue?

Thanks

from reactivesearch.

SavvyShah avatar SavvyShah commented on June 2, 2024

Can you please explain the use case here? I'm not sure how you want to use the customQuery or what you are trying to achieve.

I've made a codesandbox here. Although I have defined a customQuery it still updates the URLParams.

from reactivesearch.

rgb-panda avatar rgb-panda commented on June 2, 2024

Thanks @SavvyShah yes I can see this works, but we still need to have CustomComponent and use setQuery. Is that expected? If custom query already has the query, why do I need the setQuery?

If I just have a ReactiveComponent like below shouldn't it still work? For me, it works but doesn't reflect in URLParams

`
<ReactiveComponent
URLParams=true
componentId={componentId}
filterLabel={label}
render={() => (
...
)}
customQuery={() => {
query
}}

`

from reactivesearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.