비동기 (2) 썸네일형 리스트형 Recoil을 활용한 비동기 요청 예제 1. Library 설치 yarn add recoil 2. 구성 /src ㄴ components * UserList.jsx ㄴ recoil * state.js *App.js *Index.js 3. 코드 (1) src/App.js import React, { ErrorBoundary } from "react"; import { RecoilRoot } from "recoil"; import UserList from "./components/UserList"; function App() { return ( ); } export default App; (2) src/recoil/state.js import { atom, selector } from "recoil"; export const userListStat.. Go언어 초간단 async 예제 Go언어의 장점 중 하나로 비동기 함수실행을 매우 쉽게 구현한다는 점입니다.비동기 프로그래밍을 직접 해본적이 없어서 잘은 모르지만, 아래 예제를 보니 정말 쉬운 것 같습니다.package main import ( "fmt" "time" ) func say(s string) { for i := 0; i < 10; i++ { fmt.Println(s, "***", i) } } func main() { // 함수를 동기적으로 실행 say("Sync") // 함수를 비동기적으로 실행 go say("Async1") go say("Async2") go say("Async3") // 3초 대기 time.Sleep(time.Second * 3) } 결과C:/Go/bin/go.exe build [D:/5.System_d.. 이전 1 다음