Skip to content

Instantly share code, notes, and snippets.

@anthony-cros
Created February 8, 2019 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthony-cros/54ca835acd32a2495cd2fe5d18189b86 to your computer and use it in GitHub Desktop.
Save anthony-cros/54ca835acd32a2495cd2fe5d18189b86 to your computer and use it in GitHub Desktop.
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