CSS styles are not working on dynamic classes with amp-bind in NEXT.js

254 Views Asked by At

amp-bind-class to add 'active' class to buttons that are active. And it's working perfectly when I see it through chrome developer tools but the only problem is that the CSS is not working on them. I am using AMP in Next.js

{foo.map((item, i) => (
    <button
        className="pagination-buttons"
        data-amp-bind-class={
            "data.currentPage==" +
            i +
            "?'pagination-buttons active':'pagination-buttons'"
        }
    >
        {i + 1}
    </button>
))}

Before clicking on any button it looks like this:

enter image description here

After Clicking on any button it looks like this:

enter image description here

And this is DOM after I click

enter image description here

Expected:

enter image description here

0

There are 0 best solutions below