Skip to content

Instantly share code, notes, and snippets.

View zapkub's full-sized avatar
🦄
Doing FINE !

Rungsikorn Rungsikavanich zapkub

🦄
Doing FINE !
View GitHub Profile
// TodoInput.jsx
const TodoInput = () => {
const [textInput, setTextInput] = React.useState("");
function onTextChange(e) {
setTextInput(e.target.value);
}
return (
<input className="new-todo" value={textInput} onChange={onTextChange} />
);
// store/index.jsx
const TodoStoreProvider = ({ children }) => {
const [todos, setTodos] = useState([
{
title: "Touch myself."
},
{
title: "Sleep peacefully"
}
// TodoInput.jsx
const TodoInput = () => {
const [textInput, setTextInput] = React.useState("");
function onTextChange(e) {
setTextInput(e.target.value);
}
return (
<TodoStoreConsumer>
// TodoCount.jsx
const TodoCount = () => {
const store = React.useContext(TodoStoreContext);
return (
<span className="todo-count">
<strong>{store.todos.length}</strong> item
{store.todos.length === 1 ? "" : "s"} left
</span>
);
};
package main
import (
"context"
"fmt"
"time"
)
func perform(ctx *context.Context, name string, out chan<- string) {
for {
package main
import (
"fmt"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/go/keypair"
"net/http"
)
package main
import (
"fmt"
"github.com/stellar/go/build"
"github.com/stellar/go/clients/horizon"
"github.com/stellar/go/keypair"
"net/http"
)
package main
import (
"fmt"
"github.com/stellar/go/keypair"
)
func main (){
fmt.Println("Hello world")
package main
import (
"fmt"
"github.com/stellar/go/keypair"
"github.com/stellar/go/build"
"net/http"
)
func main (){
dep ensure -add "github.com/stellar/go/build"
dep ensure -add "github.com/stellar/go/clients/horizon"
den ensure -add "github.com/stellar/go/keypair"