Skip to content

Commit

Permalink
- return Context object from CreateContext
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketlaunchr-cto committed Apr 22, 2019
1 parent 000288f commit e2a5760
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func ForwardRef(component interface{}) *js.Object {
// embedded child component without using props.
//
// See: https://reactjs.org/docs/context.html#reactcreatecontext
func CreateContext(defaultValue ...interface{}) (Provider *js.Object, Consumer *js.Object) {
func CreateContext(defaultValue ...interface{}) (Context *js.Object, Provider *js.Object, Consumer *js.Object) {

var res *js.Object

Expand All @@ -82,7 +82,7 @@ func CreateContext(defaultValue ...interface{}) (Provider *js.Object, Consumer *
res = React.Call("createContext")
}

return res.Get("Provider"), res.Get("Consumer")
return res, res.Get("Provider"), res.Get("Consumer")
}

// CloneElement is used to clone and return a new React Element.
Expand Down
3 changes: 3 additions & 0 deletions react.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ var (
// if it is not in your global namespace.
//
// See: https://www.npmjs.com/package/react

React = js.Global.Get("React")

// ReactDOM points to the ReactDOM library. Change it
// if it is not in your global namespace.
//
// See: https://www.npmjs.com/package/react-dom
ReactDOM = js.Global.Get("ReactDOM")

// CreateReactClass points to create-react-class module.
//
// See: https://www.npmjs.com/package/create-react-class
Expand Down

0 comments on commit e2a5760

Please sign in to comment.