Refactor interactivity demos
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import React from 'react'
|
||||
import { NodeViewWrapper } from '@tiptap/react'
|
||||
|
||||
export default props => {
|
||||
const increase = () => {
|
||||
props.updateAttributes({
|
||||
count: props.node.attrs.count + 1,
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<NodeViewWrapper className="react-component">
|
||||
<span className="label">React Component</span>
|
||||
|
||||
<div className="content">
|
||||
<button onClick={increase}>
|
||||
This button has been clicked {props.node.attrs.count} times.
|
||||
</button>
|
||||
</div>
|
||||
</NodeViewWrapper>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user