'draft-js-mention-plugin programmatically open list of suggestions

I want to open list of suggestions programmatically and I want to do that after choosing one of the suggested option.

Exp : suggsions = ["Weather", "Tags"]

when choosing "Weather" i want to open list of other suggestions and in case of choosing "Tags" will open an other suggestions list.

Here is my code

const { MentionSuggestions, plugins } = useMemo(() => {
const mentionPlugin = createMentionPlugin({
  mentionComponent(mention_props) {
    if (mention_props.mention.type === "weather") {
      
      // OPEN AN OTHER LIST OF SUGGESIONS THAT RELATED TO THIS TYPE
      
      return null
    }

    return (<span className="mention">
      {mention_props.children}
    </span>);
  },
});

const { MentionSuggestions } = mentionPlugin;
const plugins = [mentionPlugin];
return { plugins, MentionSuggestions };

}, []);

Is that possible? and is there any documentation helps to do that ?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source