diff --git a/README.md b/README.md index 5ebf79b..4692463 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ React with Go [![GoDoc](http://godoc.org/github.com/rocketlaunchr/react?status.svg)](http://godoc.org/github.com/rocketlaunchr/react) [![Go Report Card](https://goreportcard.com/badge/github.com/rocketlaunchr/react)](https://goreportcard.com/report/github.com/rocketlaunchr/react) -=============== \ No newline at end of file +=============== + + + + +### Legal Information + +The license is a modified MIT license. Refer to `LICENSE` file for more details. + +**© 2018 PJ Engineering and Business Solutions Pty. Ltd.** + +### Final Notes + +Feel free to enhance features by issuing pull-requests. + +**Star** the project to show your appreciation. \ No newline at end of file diff --git a/helpers.go b/helpers.go index 74274bc..44a8dec 100644 --- a/helpers.go +++ b/helpers.go @@ -29,7 +29,8 @@ func JSX(component interface{}, props interface{}, children ...interface{}) *js. return React.Call("createElement", args...) } -// JSFn is a convenience function used to call javascript functions. +// JSFn is a convenience function used to call javascript functions that are +// part of the standard library. func JSFn(name string, args ...interface{}) *js.Object { return js.Global.Call(name, args...) } diff --git a/react_class.go b/react_class.go index 62fee11..69f6fcd 100644 --- a/react_class.go +++ b/react_class.go @@ -8,7 +8,7 @@ import ( // js object. type Map func(key string) *js.Object -// UpdaterFunc is the first argument for SetState method. +// UpdaterFunc is the first argument for SetState function. // See: https://reactjs.org/docs/react-component.html#setstate type UpdaterFunc func(props, state Map) interface{} @@ -16,8 +16,6 @@ type UpdaterFunc func(props, state Map) interface{} // See: https://reactjs.org/docs/react-component.html#setstate type SetState func(updater interface{}, callback ...func()) -type ClassDef map[string]interface{} - // ForceUpdate will force a rerender of the component. // See: https://reactjs.org/docs/react-component.html#forceupdate func ForceUpdate(this *js.Object, callback ...func()) { @@ -29,6 +27,9 @@ func ForceUpdate(this *js.Object, callback ...func()) { } } +// ClassDef is used to create custom React components. +type ClassDef map[string]interface{} + // NewClassDef will create an empty class definition which can immediately be used // to create a React component. func NewClassDef(displayName string) ClassDef { diff --git a/react_events.go b/react_events.go index 8fd326a..c66cb03 100644 --- a/react_events.go +++ b/react_events.go @@ -8,6 +8,7 @@ import ( // SyntheticEvent represents a SyntheticEvent. // See: https://reactjs.org/docs/events.html#overview type SyntheticEvent struct { + // O represents the original React SyntheticEvent. O *js.Object } diff --git a/utility.go b/utility.go index c33f526..90ea5cf 100644 --- a/utility.go +++ b/utility.go @@ -55,10 +55,10 @@ func AddClass(currentClasses, newClass string) string { } // RemoveClass removes a class from an existing list of classes. -func RemoveClass(currentClasses, newClass string) string { +func RemoveClass(currentClasses, removeClass string) string { uniq := splitClasses(currentClasses) - delete(uniq, newClass) + delete(uniq, removeClass) pre := []string{} for k := range uniq {