diff --git a/examples/event_handling/events_handling_def.go b/examples/event_handling/events_handling_def.go index 14e64a4..109559f 100644 --- a/examples/event_handling/events_handling_def.go +++ b/examples/event_handling/events_handling_def.go @@ -48,7 +48,7 @@ func init() { return func(this *js.Object, e *react.SyntheticEvent, props, state react.Map, setState react.SetState) { var eState eventsState - react.HydrateState(this, &eState) + react.UnmarshalState(this, &eState) // Update counter setState(func(props, state react.Map) interface{} { diff --git a/examples/event_handling/main.go b/examples/event_handling/main.go index 118738b..febd46b 100644 --- a/examples/event_handling/main.go +++ b/examples/event_handling/main.go @@ -3,13 +3,10 @@ package main import ( "github.com/gopherjs/gopherjs/js" "github.com/rocketlaunchr/react" - "honnef.co/go/js/dom" ) -var document = dom.GetWindow().Document() - func main() { - domTarget := document.GetElementByID("app") + domTarget := react.GetElementByID("app") // An example using Functional Components // See: https://reactjs.org/docs/components-and-props.html diff --git a/examples/event_handling/title_def.go b/examples/event_handling/title_def.go index 83ef191..ac5d728 100644 --- a/examples/event_handling/title_def.go +++ b/examples/event_handling/title_def.go @@ -21,7 +21,7 @@ func init() { titleDef.Render(func(this *js.Object, props, state react.Map) interface{} { var tProps TitleProps - react.HydrateProps(this, &tProps) + react.UnmarshalProps(this, &tProps) title := tProps.Title diff --git a/examples/uptime/main.go b/examples/uptime/main.go index b7018dd..0c999eb 100644 --- a/examples/uptime/main.go +++ b/examples/uptime/main.go @@ -2,16 +2,12 @@ package main import ( "github.com/rocketlaunchr/react" - "honnef.co/go/js/dom" ) -var document = dom.GetWindow().Document() - func main() { - domTarget := document.GetElementByID("app") + domTarget := react.GetElementByID("app") title := "UPTIME TIMER" react.Render(react.JSX(ContainerComponent, &ContainerProps{Title: title}), domTarget) - } diff --git a/examples/uptime/timer_def.go b/examples/uptime/timer_def.go index 5a50a9d..4aebc6a 100644 --- a/examples/uptime/timer_def.go +++ b/examples/uptime/timer_def.go @@ -32,7 +32,7 @@ func init() { // Using props in here is considered bad practice. It is only for example purposes. var tProps TimerProps - react.HydrateProps(this, &tProps) + react.UnmarshalProps(this, &tProps) return TimerState{ Elapsed: time.Now().Unix() - tProps.StartTime, @@ -47,7 +47,7 @@ func init() { timerDef.SetMethod("tick", func(this *js.Object, props, state react.Map, setState react.SetState, arguments []*js.Object) interface{} { var tProps TimerProps - react.HydrateProps(this, &tProps) + react.UnmarshalProps(this, &tProps) elapsed := time.Now().Unix() - tProps.StartTime @@ -67,7 +67,7 @@ func init() { timerDef.Render(func(this *js.Object, props, state react.Map) interface{} { var tState TimerState - react.HydrateState(this, &tState) + react.UnmarshalState(this, &tState) text := "Uptime counter:" + strconv.Itoa(int(tState.Elapsed)) diff --git a/examples/uptime/title_def.go b/examples/uptime/title_def.go index 83ef191..ac5d728 100644 --- a/examples/uptime/title_def.go +++ b/examples/uptime/title_def.go @@ -21,7 +21,7 @@ func init() { titleDef.Render(func(this *js.Object, props, state react.Map) interface{} { var tProps TitleProps - react.HydrateProps(this, &tProps) + react.UnmarshalProps(this, &tProps) title := tProps.Title