https://github.com/bep/grouter
Highly Experimental React-Router Bindings for GopherJS
https://github.com/bep/grouter
Last synced: about 1 year ago
JSON representation
Highly Experimental React-Router Bindings for GopherJS
- Host: GitHub
- URL: https://github.com/bep/grouter
- Owner: bep
- License: mit
- Created: 2016-04-29T10:09:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-02T23:15:13.000Z (over 9 years ago)
- Last Synced: 2025-02-28T13:48:54.831Z (about 1 year ago)
- Language: Go
- Size: 12.7 KB
- Stars: 11
- Watchers: 6
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-react-router
[](https://travis-ci.org/bep/grouter)
[](https://godoc.org/github.com/bep/grouter)
React-Router Bindings for GopherJS.
Will need https://github.com/bep/gr to run.
See it in action here: [http://bego.io/goreact/examples/router/](http://bego.io/goreact/examples/router/)
See also:
* https://github.com/reactjs/react-router
* https://cdnjs.com/libraries/react-router
## Example Setup
```go
var (
component1 = gr.New(&clickCounter{title: "Counter 1", color: "#ff0066"})
component2 = gr.New(&clickCounter{title: "Counter 2", color: "#339966"})
component3 = gr.New(&clickCounter{title: "Counter 3", color: "#0099cc"})
component3_2 = gr.New(&clickCounter{title: "Counter 3_2", color: "#ffcc66"})
// WithRouter makes this.props.router happen.
appComponent = gr.New(new(app), gr.Apply(grouter.WithRouter))
router = grouter.New("/", appComponent).With(
grouter.NewIndexRoute(grouter.Components{"main": component1}),
grouter.NewRoute("c1", grouter.Components{"main": component1}),
grouter.NewRoute("c2", grouter.Components{"main": component2}),
grouter.NewRoute("c3", grouter.Components{"main": component3, "sub": component3_2}),
)
)
```