How to use the @umijs/hooks.useClickAway function in @umijs/hooks

To help you get started, we’ve selected a few @umijs/hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leftstick / hosts-high / src / renderer / pages / index / components / EditableCell / index.js View on Github external
function EditableCell({ record, property }) {
  const { acquired } = usePermissionModel()
  const [editing, setEditing] = useState(false)
  const { modifyHost } = useHostsModel()
  const ref = useClickAway(() => {
    setEditing(false)
  })

  if (!editing) {
    return (
      <div style="{{"> {
          acquired &amp;&amp; setEditing(true)
        }}
      &gt;
        {record[property]}
      </div>
    )
  }