This issue is because of your template - <button className="btn">set countor </button>
is redering like below.
So that if you try to access using class query selector, it will return undefined. You can use class
instead of className
.
return {
__html: '<button class="btn">set countor </button>'
};
Working Code - https://codesandbox.io/s/brave-meadow-qitjb?file=/src/App.js:87-157
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…