我正在寻找一种可靠的方法(就目前古腾堡过程中的“可靠”而言);)在客户端水合块 .

例:

import * as React from 'react'
const { registerBlockType } = wp.blocks



registerBlockType('example-blocks/super-simple-hello-click-block', {
  title: 'Super Simple Example Block',
  icon: 'megaphone',
  category: 'widgets',
  edit: () => <p>Only shown in Editor</p>,
  save: FrontendComponent
})

class FrontendComponent extends React.Component {

  render() {
    return (
      <div>
        <button onClick={() => console.log('Hello from console!')}>Click</button>
      </div>
    )
  }

}

使用这种方法,click事件不会触发(服务器端渲染)

任何人都可以帮我在这里给水块加水并“重新激活”这些事件吗?

非常感谢 :)