0

I'm getting this error when trying to use ReactiveSearch for a search bar. This is how I'm initialising it:

render() {
    const { tenantConfig, size, componentId } = this.props;
    return (
      <ReactiveComponent
        componentId={componentId}
        defaultQuery={this.defaultQuery}
      >
        <SearchDropdownDashboard
          size={size}
          handleSearchDashboard={this.handleSearchDashboard}
          fetching={this.state.fetching}
          tenantConfig={tenantConfig}
        />
      </ReactiveComponent>
    );
  }

And this is the function that is being passed in:

defaultQuery = () => {
    const { dashboardText } = this.state;
    const { mustNotObj } = this.props;

    let obj;

    obj = {
      query: {
        bool: {
          must_not: mustNotObj,
          must: multiMatchSearch(dashboardText)
        }
      },
      from: 0,
      size: 20
    };

    return obj;
  };

Any suggestions as to what I'm doing wrong here? The function seems to be passed correctly to the component.

1 Answer 1

2

If you are using v3, then it is due to the recent changes introduced in API. You will need to use render prop or React render Pattern as done in the below example.

You can check the docs here: https://opensource.appbase.io/reactive-manual/advanced/reactivecomponent.html#usage-with-defaultquery.

I have created the example of Usage of ReactiveComponent on both the versions:

v3 : https://codesandbox.io/s/serene-ritchie-rjo3m

v2 : https://codesandbox.io/s/tender-ramanujan-f3g31

Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

Some modifications but ty, that helped

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.