This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type tanah interface { | |
luas(size float32) float32 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"golang.org/x/text/currency" | |
"golang.org/x/text/language" | |
"golang.org/x/text/message" | |
"golang.org/x/text/number" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import useWebSocket, { ReadyState } from 'react-use-websocket' | |
function getStatus(readyState) { | |
const connectionStatus = { | |
[ReadyState.CONNECTING]: 'Connecting', | |
[ReadyState.OPEN]: 'Open', | |
[ReadyState.CLOSING]: 'Closing', | |
[ReadyState.CLOSED]: 'Closed', | |
[ReadyState.UNINSTANTIATED]: 'Uninstantiated', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import useWebSocket, { ReadyState } from 'react-use-websocket' | |
function getStatus(readyState) { | |
const connectionStatus = { | |
[ReadyState.CONNECTING]: 'Connecting', | |
[ReadyState.OPEN]: 'Open', | |
[ReadyState.CLOSING]: 'Closing', | |
[ReadyState.CLOSED]: 'Closed', | |
[ReadyState.UNINSTANTIATED]: 'Uninstantiated', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, memo, useCallback } from "react" | |
function todos({ todos, addTodo }) { | |
console.log("child render") | |
return ( | |
<> | |
<h2>My Todos</h2> | |
{todos.map((todo, index) => { | |
return <p key={index}>{todo}</p> | |
})} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, memo } from "react" | |
function todos({ todos }) { | |
console.log("child render") | |
return ( | |
<> | |
<h2>My Todos</h2> | |
{todos.map((todo, index) => { | |
return <p key={index}>{todo}</p> | |
})} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Provider, useSelector, useDispatch } from 'react-redux' | |
import { createStore } from 'redux' | |
function Counter() { | |
const count = useSelector(state => state.count) | |
const dispatch = useDispatch() | |
const action = { | |
type: "ADD", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Provider, useSelector, useDispatch } from 'react-redux' | |
import { createStore } from 'redux' | |
function Counter() { | |
const count = useSelector(state => state.count) | |
const dispatch = useDispatch() | |
const action = { | |
type: "ADD", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext, useReducer, createContext, useEffect } from 'react' | |
function Counter() { | |
const { count, setCount } = useContext(CountContext) | |
useEffect(() => { | |
document.title = `You clicked ${count} times` | |
}, [count]) | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useContext, useReducer, createContext } from 'react' | |
function Counter() { | |
const { count, setCount } = useContext(CountContext) | |
return ( | |
<div> | |
<p>You clicked {count} times</p> | |
<button onClick={() => setCount(count + 1)}> | |
Click me | |
</button> |