React-tags: ์„œ๋ฒ„ ์ธก ์ž๋™ ์™„์„ฑ ์˜ˆ์ œ?

์— ๋งŒ๋“  2020๋…„ 04์›” 30์ผ  ยท  4์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: i-like-robots/react-tags

question

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์šด ์ข‹๊ฒŒ๋„ ์ €๋Š” ๋ฉฐ์น  ์ „์— ์ด๊ฒƒ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ˜„: https://github.com/i-like-robots/react-tags/compare/v5.13.0...async-fetch-example

๋ชจ๋“  4 ๋Œ“๊ธ€

์šด ์ข‹๊ฒŒ๋„ ์ €๋Š” ๋ฉฐ์น  ์ „์— ์ด๊ฒƒ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ˜„: https://github.com/i-like-robots/react-tags/compare/v5.13.0...async-fetch-example

์•ผ!, ์ด๊ฒƒ๋งŒ ์ฐพ๊ณ  ์žˆ์–ด!

axios ๋ฐ ํ›„ํฌ์˜ ์˜ˆ:

  //initial api call
  const [{ data: labelsData }, doGetLabels] = useAxios({
    url: '/labels',
  })

  const [suggestions, setSuggestions] = useState([])
  const [busy, setBusy] = useState(false)
  const handleInputChange = debounce((name) => {
    if (!busy) {
      setBusy(true)
      doGetLabels({ params: { name } })
    }
  })
  //getResponseData is my custom parser for the BE response
  useEffect(() => {
    const labels = labelsData ? getResponseData(labelsData).labels : []
    if (setBusy) {
      setBusy(false)
    }
    setSuggestions(labels)
  }, [labelsData])

๋‚˜๋จธ์ง€ ์ฝ”๋“œ๋Š” @i-like-robots PR๊ณผ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€๋ฉ๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. @i-like-robots์— ์ž‘์€ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
์˜ต์…˜ ๋ชฉ๋ก์€ onInput ์ปค์Šคํ…€ ํ•ธ๋“ค๋Ÿฌ https://github.com/i-like-robots/react-tags/blob/6.0/lib/ReactTags.js#L130 ๋ฐ”๋กœ ๋‹ค์Œ์— ์—…๋ฐ์ดํŠธ๋ฉ๋‹ˆ๋‹ค
๊ทธ๋Ÿฌ๋‚˜ onInput ํ•ธ๋“ค๋Ÿฌ ๋‚ด๋ถ€์—์„œ ์„œ๋ฒ„๋ฅผ ์ฟผ๋ฆฌํ•˜๋ฉด ์‹œ๊ฐ„์ด ๊ฑธ๋ฆฝ๋‹ˆ๋‹ค.
๊ฒฐ๊ณผ์ ์œผ๋กœ ์˜ต์…˜ ๋ชฉ๋ก์—๋Š” ํ•ญ์ƒ ์ตœ๊ทผ ํ˜ธ์ถœ์ด ์•„๋‹Œ ์ด์ „ ํ˜ธ์ถœ์˜ ์ œ์•ˆ ๋ชฉ๋ก์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰

๊ด€๋ จ ๋ฌธ์ œ

jraack picture jraack  ยท  6์ฝ”๋ฉ˜ํŠธ

famouspotatoes picture famouspotatoes  ยท  5์ฝ”๋ฉ˜ํŠธ

V6
i-like-robots picture i-like-robots  ยท  11์ฝ”๋ฉ˜ํŠธ

williamsidewalk picture williamsidewalk  ยท  4์ฝ”๋ฉ˜ํŠธ

thienanle picture thienanle  ยท  9์ฝ”๋ฉ˜ํŠธ