All Projects → bep → Gr

bep / Gr

Licence: other
Aka Go React: GopherJS bindings for Facebook React. NOTE: Still early and not production ready.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Gr

iris
The interpreter of ISLisp
Stars: ✭ 58 (-64.2%)
Mutual labels:  gopherjs
Vecty Router
A declarative client-side router for Vecty applications.
Stars: ✭ 24 (-85.19%)
Mutual labels:  gopherjs
Humble
The main repository for Humble. Issues and new feature requests not related to any specific sub-packages go here.
Stars: ✭ 92 (-43.21%)
Mutual labels:  gopherjs
grpcweb-boilerplate
A minimal repo containing all the boilerplate for getting started with GopherJS using gRPC-Web
Stars: ✭ 45 (-72.22%)
Mutual labels:  gopherjs
vecty-chatapp
Vecty Samples
Stars: ✭ 13 (-91.98%)
Mutual labels:  gopherjs
Instago
Download/access photos, videos, stories, story highlights, postlives, following and followers of Instagram
Stars: ✭ 59 (-63.58%)
Mutual labels:  gopherjs
gox
JSX for Go
Stars: ✭ 165 (+1.85%)
Mutual labels:  gopherjs
Glua
Maybe you should use https://github.com/fiatjaf/flua instead of this
Stars: ✭ 142 (-12.35%)
Mutual labels:  gopherjs
Goplayspace
Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more
Stars: ✭ 765 (+372.22%)
Mutual labels:  gopherjs
Grpcweb Example
An example implementation of a GopherJS client and a Go server using the Improbable gRPC-Web implementation
Stars: ✭ 85 (-47.53%)
Mutual labels:  gopherjs
go-pouchdb
GopherJS bindings for PouchDB ⚠️ NOTICE ⚠️ this package has been superseded by https://github.com/go-kivik/kivik
Stars: ✭ 12 (-92.59%)
Mutual labels:  gopherjs
golang-101
🍺 In-depth internals, my personal notes, example codes and projects. Includes - Thousands of codes, OOP, Concurrency, Parallelism, Goroutines, Mutexes & Wait Groups, Testing in Go, Go tool chain, Backend web development, Some projects including Log file parser using bufio.Scanner, Spam Masker, Retro led clock, Console animations, Dictionary pro…
Stars: ✭ 61 (-62.35%)
Mutual labels:  gopherjs
Userpages
my blog for sharing (source code for siongui.github.io)
Stars: ✭ 64 (-60.49%)
Mutual labels:  gopherjs
react
Super lightweight Go bindings for react.js
Stars: ✭ 130 (-19.75%)
Mutual labels:  gopherjs
Gu
A web ui library for Go. [DEPRECATED]
Stars: ✭ 102 (-37.04%)
Mutual labels:  gopherjs
qlql
No description or website provided.
Stars: ✭ 26 (-83.95%)
Mutual labels:  gopherjs
Gopherjs Electron
Gopherjs bindings for Electron with an API translator.
Stars: ✭ 26 (-83.95%)
Mutual labels:  gopherjs
Gopherjs Vue
VueJS bindings for gopherjs
Stars: ✭ 142 (-12.35%)
Mutual labels:  gopherjs
Godom
Make DOM manipulation in Go as similar to JavaScript as possible. (via GopherJS or WebAssembly)
Stars: ✭ 125 (-22.84%)
Mutual labels:  gopherjs
Vdom
A virtual dom implementation written in go which is compatible with gopherjs
Stars: ✭ 83 (-48.77%)
Mutual labels:  gopherjs

Go React

Build Status GoDoc Go Report Card

See Also:

GopherJS bindings for Facebook React.

NOTE: Still early and not production ready.

Examples

NOTE: Make sure that your GopherJS is up-to-date before running these: go get -u github.com/gopherjs/gopherjs

For a live demo of the examples below, see http://bego.io/gr/ (may not be up-to-date).

There are some runnable examples in /examples. Just navigate to that folder and do a:

gopherjs serve

Then navigate to http://localhost:8080/github.com/bep/gr/examples/.

To get a sense of the API, here is the click-counter example:

func main() {
	component := gr.New(new(clickCounter))

	gr.RenderLoop(func() {
		component.Render("react", gr.Props{})
	})
}

type clickCounter struct {
	*gr.This
}

// Implements the StateInitializer interface.
func (c clickCounter) GetInitialState() gr.State {
	return gr.State{"counter": 0}
}

// Implements the Renderer interface.
func (c clickCounter) Render() gr.Component {
	counter := c.State()["counter"]
	message := fmt.Sprintf(" Click me! Number of clicks: %v", counter)

	elem := el.Div(
		el.Button(
			gr.CSS("btn", "btn-lg", "btn-primary"),
			gr.Style("color", "orange"),
			gr.Text(message),
			evt.Click(c.onClick)))

	return examples.Example("Click Counter", elem)
}

func (c clickCounter) onClick(event *gr.Event) {
	c.SetState(gr.State{"counter": c.State().Int("counter") + 1})
}

// Implements the ShouldComponentUpdate interface.
func (c clickCounter) ShouldComponentUpdate(next gr.Cops) bool {
	return c.State().HasChanged(next.State, "counter")
}

For help installing GopherJS, please visit that cool project.

Inspiration

This project is highly inspired by Vecty, a promising and pure Go React-like framework. If you're not heavily invested in Facebook's React, take that for a spin.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].