How to update Tippy width on reference change?

Viewed 307

I'm trying to use a modifier to update the state of the tippy instance as the ref changes, with no luck:

modifiers: [
                {
                  name: "setMaxWidth",
                  phase: "write",
                  enabled: true,
                  fn: ({ state, instance }) => {
                    console.log(state);
                    const refWidth = state.rects.reference.width;
                    state.rects.popper.width = refWidth;
                    return state;
                  },
                },
              ],

What am I doing wrong?

0 Answers
Related