Instantly share code, notes, and snippets.

Embed
What would you like to do?
package minimal
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
object Bindings {
// ===========================================================================
// ReactDOM
/** https://github.com/facebook/react/blob/v16.8.0/packages/react-dom/src/client/ReactDOM.js#L373 (TODO: confirm) */
@js.native
@JSImport(
module = "react-dom",
name = JSImport.Namespace)
object ReactDOM extends js.Object {
def render(
element : js.Any,
container : js.Any)
: js.Any
= js.native
}
// ===========================================================================
// React
@js.native
@JSImport(
module = "react",
name = JSImport.Namespace)
object React extends js.Object {
/** https://github.com/facebook/react/blob/v16.8.0/packages/react/src/React.js#L83 >
* https://github.com/facebook/react/blob/v16.8.0/packages/react/src/ReactElement.js#L171
*
* @see https://reactjs.org/docs/jsx-in-depth.html */
def createElement(
`type` : js.Any,
config : js.Any = null /* TODO? */,
children : js.Any = null /* TODO? */)
: js.Any
= js.native
}
// ===========================================================================
/** @see https://github.com/facebook/react/blob/v16.8.0/packages/react/src/ReactBaseClasses.js#L21 */
@js.native
@JSImport(
module = "react",
name = "Component")
abstract class Component(
props : js.Object = js.Object.apply(),
context : js.Any = null /* TODO? */,
updater : js.Any = null /* TODO? */)
extends js.Object {
def render(): js.Any
}
}
// ===========================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment