Created
February 8, 2019 16:02
-
-
Save anthony-cros/54ca835acd32a2495cd2fe5d18189b86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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