ampproject / amp-react-prototype

A scratch pad to experiment with React rendered AMP Components
Apache License 2.0
36 stars 9 forks source link

Exporter #52

Open dvoytenko opened 4 years ago

dvoytenko commented 4 years ago

Most of AMP elements have standard "public" state, including:

And also AMP elements have some imperative APIs such as:

The two questions are:

  1. How to export these APIs to AMP framework.
  2. Whether and how to export these APIs to React layer.

For imperative API exporting we can use forwardRef and useImperativeHandle. We need to be careful with such APIs however - changing their shape has to follow backward-compatibility rules.

dvoytenko commented 4 years ago

Recommendation is to do minimal interface. Possible it could include .element.

dvoytenko commented 4 years ago

/cc @jridgewell