Skip to content

Commit

Permalink
- add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketlaunchr-cto committed Oct 16, 2018
1 parent 80c6d24 commit cd443b2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
===============
===============




### 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.
3 changes: 2 additions & 1 deletion helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}
Expand Down
7 changes: 4 additions & 3 deletions react_class.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ 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{}

// SetState is used to asynchronously update the state.
// 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()) {
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions react_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cd443b2

Please sign in to comment.