New tool to use React with Observable

I’ve just updated the notebook:

  • I’ve removed the dynamic import call.

  • The internal API has mostly been rewritten.

  • The render function now has support for viewof:

    viewof foo = render(({ useSetter }) => {
      const [text, setText] = useState('')
      useSetter(text)
      return jsx`
        <input
          type="text"
          placeholder="..."
          value=${text}
          onChange=${event => setText(event.target.value)}
        />
      `
    })
    
    foo // is the value of the text input
    
1 Like