<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Jaro의 공부하는 블로그입니다.</title>
    <link>https://jaroinside.tistory.com/</link>
    <description>대한민국 ,
인천 ,
남자 ,
기혼 ,
개발자 
jaro0116@gmail.com ,
https://github.com/JaroInside
https://www.linkedin.com/in/seong-eon-park-16a97b113/</description>
    <language>ko</language>
    <pubDate>Wed, 1 Jul 2026 08:41:20 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>Jaro</managingEditor>
    <image>
      <title>Jaro의 공부하는 블로그입니다.</title>
      <url>https://t1.daumcdn.net/cfile/tistory/27C748335964AC4B10</url>
      <link>https://jaroinside.tistory.com</link>
    </image>
    <item>
      <title>SPA 를 AWS S3 정적 웹 호스팅시 문제 해결</title>
      <link>https://jaroinside.tistory.com/46</link>
      <description>&lt;p&gt;최근 React를 이용하여 클라이언트 사이드 SPA 를 공부하고 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;작업한것을 aws s3의 웹 호스팅을 이용하여 올려서 테스트를 하고 있는데,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;인덱스 주소가 아닌 다른 주소로 접근하거나 새로고침을 하면&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;404 페이지가 나오게 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이것은 spa가 하나의 html을 갖고있기 때문인데요,&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;다른 주소로 접근시 예를들어 aaa/about 페이지 접근 혹은 새로고침시&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;about.html을 찾는데 없으니까 404 페이지를 띄워주게 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이때 해결 방법은&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/999FF933598C822A1F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F999FF933598C822A1F&quot; width=&quot;500&quot; height=&quot;559&quot; filename=&quot;스크린샷 2017-08-11 오전 12.55.15.jpg&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;이렇게 오류 문서에도 index.html을 호스팅 해주면 정상적으로 작동합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;(물론 에러페이지는 따로 만드셔야 합니다 )&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>삽질 &amp;amp; 해결</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/46</guid>
      <comments>https://jaroinside.tistory.com/46#entry46comment</comments>
      <pubDate>Fri, 11 Aug 2017 00:57:01 +0900</pubDate>
    </item>
    <item>
      <title>홈페이지 제작중</title>
      <link>https://jaroinside.tistory.com/45</link>
      <description>&lt;p&gt;리액트를 이용하여 홈페이지를 제작해보고 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;최소한의 라이브러리 사용을 목표로 스터디를 위해 달려봅니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://jaroinside.com&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;jaroinside.com&lt;/a&gt;&lt;/p&gt;</description>
      <category>Jaro/단상</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/45</guid>
      <comments>https://jaroinside.tistory.com/45#entry45comment</comments>
      <pubDate>Tue, 8 Aug 2017 15:26:42 +0900</pubDate>
    </item>
    <item>
      <title>현재 공부하는 목록</title>
      <link>https://jaroinside.tistory.com/44</link>
      <description>&lt;p&gt;Todo&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;HTML, CSS 기초부터 다시&lt;/p&gt;&lt;p&gt;react&lt;/p&gt;&lt;p&gt;typescript&lt;/p&gt;&lt;p&gt;firebas&lt;/p&gt;&lt;p&gt;aws&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Jaro/단상</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/44</guid>
      <comments>https://jaroinside.tistory.com/44#entry44comment</comments>
      <pubDate>Mon, 7 Aug 2017 13:09:38 +0900</pubDate>
    </item>
    <item>
      <title>최근 공부를 하면서 깨닫는 점</title>
      <link>https://jaroinside.tistory.com/43</link>
      <description>&lt;p&gt;최근 취업준비로 기술공부를 하면서 느끼는점.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;근 2년간 실무를 접하면서 나름 노하우도 쌓이고, 기술에 대해 아주 조금은 알고있다고 생각했지만, 아니었다는 점.&lt;/p&gt;&lt;p&gt;특히, 어떠한 기능을 이름도 모르고, 왜 쓰는지도 모르면서 그냥 쓰고 있었다는점.&lt;/p&gt;&lt;p&gt;마치 글을 모르면서 말은 할줄 아는 까막눈처럼 사용할줄만 아는 것들이 많다는 점.&lt;/p&gt;&lt;p&gt;언제 무너질지 모르는 부실공사처럼 기초가 너덜너덜하다는 점&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;다만.. 이제라도 깨달았으니 빠르게 기초공사를 다시 한다는 점.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 496px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/998B08335984BA060F&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F998B08335984BA060F&quot; width=&quot;496&quot; height=&quot;532&quot; filename=&quot;박명수어록.png&quot; filemime=&quot;image/jpeg&quot; style=&quot;&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;기술적 까막눈이 되지 말자!!&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Jaro/단상</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/43</guid>
      <comments>https://jaroinside.tistory.com/43#entry43comment</comments>
      <pubDate>Sat, 5 Aug 2017 03:17:08 +0900</pubDate>
    </item>
    <item>
      <title>클라우드 컴퓨팅. 그리고 서비스</title>
      <link>https://jaroinside.tistory.com/42</link>
      <description>&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;클라우드 컴퓨팅&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;dt class=&quot;first&quot; style=&quot;margin: 0px; padding: 0px; font-family: 돋움, Dotum, AppleGothic, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif; font-size: 12px; text-align: right;&quot;&gt;&lt;span class=&quot;fnt_e30&quot; lang=&quot;en&quot; style=&quot;font-family: Tahoma; font-size: 14px; color: rgb(119, 119, 119); padding-right: 2px;&quot;&gt;&lt;a href=&quot;http://endic.naver.com/enkrEntry.nhn?entryId=f857d21a306b4ca18e603fe5e2ea8d7e&amp;amp;query=cloud&quot; class=&quot;N=a:wrd.entry,r:1,i:f857d21a306b4ca18e603fe5e2ea8d7e&quot; lang=&quot;en&quot; style=&quot;color: rgb(0, 52, 172); line-height: 17px;&quot;&gt;&lt;strong lang=&quot;en&quot;&gt;cloud&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;미국·영국&amp;nbsp;&lt;span class=&quot;fnt_e25&quot; style=&quot;font-family: &amp;quot;Lucida Sans Unicode&amp;quot;; position: relative; top: -1px; left: -1px;&quot;&gt;[klaʊd]&lt;/span&gt;&lt;/dt&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;span class=&quot;align_line&quot; style=&quot;margin-left: 0px; position: relative; line-height: 24px; display: block; overflow: hidden; zoom: 1; padding-left: 0px; font-family: 돋움, Dotum, AppleGothic, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif; font-size: 12px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;dd style=&quot;margin: -1px 0px 0px; padding: 0px; overflow: hidden; zoom: 1; font-family: 돋움, Dotum, AppleGothic, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif; font-size: 12px; text-align: right;&quot;&gt;&lt;p&gt;&lt;span class=&quot;fnt_k09&quot; style=&quot;font-family: gulim; font-size: 13px; color: rgb(102, 102, 102); display: inline-block; position: relative; left: -1px; margin-right: 0px;&quot;&gt;[명사]&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;fnt_k05&quot; style=&quot;font-family: gulim; font-size: 13px;&quot;&gt;구름&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;lt;네이버 어학사전&amp;gt;&lt;/p&gt;&lt;/dd&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;클라우드 컴퓨팅에서의 클라우드( cloud )는 통신망, 즉 인터넷을 의미합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;수많은 하드웨어와 소프트웨어등과 같은 자원들이 통신망으로 연결되어 하나의 커다란 구름처럼 형상화 되어 붙여진 이름 이라고 생각됩니다.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;즉 인터넷이 보장된 환경이라면, 언제, 어디서든 동일한 시스템을 사용 가능하게 보장해 주는것을 의미합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/9919FF335982D75732&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F9919FF335982D75732&quot; width=&quot;500&quot; height=&quot;453&quot; filename=&quot;aa457b6a232fa251d877e0eba50c084989af4f3b88a652381bdc145b1ab10422.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&amp;lt; 사진출처 : 나무위키 - 클라우드 컴퓨팅&amp;gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;a href=&quot;https://namu.wiki/w/%ED%81%B4%EB%9D%BC%EC%9A%B0%EB%93%9C%20%EC%BB%B4%ED%93%A8%ED%8C%85&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://namu.wiki/w/%ED%81%B4%EB%9D%BC%EC%9A%B0%EB%93%9C%20%EC%BB%B4%ED%93%A8%ED%8C%85&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;기술의 발전은 클라우드 환경을 더욱더 발전시키고 있으며, 클라우드 컴퓨팅 서비스 또한 계속해서 증가하고 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;클라우드 컴퓨팅 서비스는 클라우드 서비스 플랫폼에서 컴퓨트, 스토리지, 데이터베이스 등등 여러 IT 리소스를 필요에 따라 제공하고, 사용한 만큼만 요금을 지불하는 것을 의미합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;클라우드 컴퓨팅 서비스 유형에는 여러가지가 있지만, 대표적으로&amp;nbsp;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: HelveticaNeue, Helvetica, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;인프라(IaaS), 서비스로서의 플랫폼(PaaS), 서비스로서의 소프트웨어(SaaS), 백엔드(BaaS) 서비스가 있습니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: HelveticaNeue, Helvetica, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;1. IaaS -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;Infrastructure as a Service&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;Apple SD Gothic Neo&amp;quot;, arial, sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;Apple SD Gothic Neo&amp;quot;, arial, sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;IaaS&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;는 서버, 스토리지, 네트워크를 가상화 환경으로 만들어, 필요에 따라 인프라 자원을 사용할 수 있게 서비스를 제공하는 형태입니다. 클라우트 컴퓨팅 서비스 모델 중에서 가장 많은 업체가 사용하는 유형으로, IaaS를 사용하는 경우, 서버의 설정이나 관리는 사용자가 직접 하고 운영하여야 합니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;서비스로서의 인프라는 IT 리소스에 대해 가장 높은 수준의 유연성과 관리 제어를 제공하며 오늘날 많은 IT 부서와 개발자에게 익숙한 기존 IT 리소스와 가장 비슷합니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;Apple SD Gothic Neo&amp;quot;, arial, sans-serif; font-size: 16px;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;대표적으로는 AWS의 S3 와 EC2 서비스가 IaaS 서비스입니다.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;Apple SD Gothic Neo&amp;quot;, arial, sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;2. PaaS -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;Platform as a Service&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;PaaS는 사용자에게 애플리케이션을 개발하는 데 필요한 개발환경, 프레임워크 등의 플랫폼을 제공하는 서비스입니다.&lt;/span&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: HelveticaNeue, Helvetica, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;&amp;nbsp;기본 인프라(일반적으로 하드웨어와 운영 체제)를 관리할 필요가 없어 애플리케이션 개발과 관리에 집중할 수 있습니다. 즉, 애플리케이션 실행과 관련된 리소스 구매, 용량 계획, 소프트웨어 유지 관리, 패치 또는 다른 모든 획일적인 작업에 대한 부담을 덜어 더욱 효율적이 되도록 해줍니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;대표적으로는&amp;nbsp;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;구글 앱엔진(Google App Engine)과 윈도 애저(Window Azure)가 PaaS 서비스입니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;3. SaaS -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;Software as a Service&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;font color=&quot;#222222&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;SaaS 는 서비스 제공자에 의해 실행되고 관리되는 완전한 제품을 제공합니다.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px; color: rgb(34, 34, 34);&quot;&gt;예를들어, 이전에 개인 PC에 설치하여 사용하던 애플리케이션 제품을 클라우드 상에서 서비스하는것을 의미합니다.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: HelveticaNeue, Helvetica, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;SaaS 오퍼링을 사용하면 서비스가 어떻게 유지 관리되는지 또는 기본 인프라가 어떻게 관리되는지 생각할 필요가 없으므로 개발 혹은 유지 관리 없이&amp;nbsp;해당 특정 소프트웨어를 어떻게 사용할지만 생각하면 됩니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: HelveticaNeue, Helvetica, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;대표적으로는&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;Salesforce Sales Cloud, Google Docs, Microsoft Office 365 등이 SaaS 서비스입니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;Apple SD Gothic Neo&amp;quot;, arial, sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;4. BaaS -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(34, 34, 34); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 14pt;&quot;&gt;Backend as a Service&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: HelveticaNeue, Helvetica, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;BaaS는 모바일 앱 &amp;amp; 웹 앱 개발 시 자주 사용하는 공통적인 백엔드(서버) 기능들을 표준화하여 API형태로 제공합니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;즉&amp;nbsp;BaaS를 통해 개발자들은 백엔드플랫폼을 개발하지 않고 서비스형태로 빌려 사용하게 되어, 프론트엔드 개발에 집중할 수 있게 됩니다.&amp;nbsp;BaaS 사업자가 제공하는 백엔드기능에는 일반적으로 데이터저장(data storage), 사용자관리(user management), 푸시알림(push notifications), 위치서비스(location services), 데이터분석(analytics) 등이 해당됩니다. 최근에는 계정등록, 구매확인, 이용자 발생 알림, 패스워드 재설정 등을 구성할 수 있는 거래 이메일 발송 기능도 고객유지 및 참여 전략의 일환으로 BaaS 플랫폼을 통해 제공되고 있습니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;대표적으로는 google의 firebase 입니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr class=&quot;tx-hr-border-3&quot; style=&quot;display:block; border: black 0 none; border-top: black 1px dotted; height: 1px&quot;&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;결론적으로는 클라우드 컴퓨팅은 로컬이 아닌 인터넷 상에서 컴퓨팅 환경을 조성하는것을 의미하고,&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;그에 따라 서비스들이 존재하는데,&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;IaaS는 가장 기본적인 컴퓨팅 환경을 서비스 해주는 것이고,&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;PaaS는 개발에 필요한 플랫폼을 서비스 해주는 것입니다. 즉 IaaS보다는 좀더 많은것을 서비스 해주는 형태로, 개발에 필요한 틀(?) 을 서비스 해준다고 생각할수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;SaaS는 아예 애플리케이션 자체를 서비스 해주는 형태로, 완성품을 서비스 해준다고 생각할수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;BaaS는 개발 과정중 프론트 엔드 개발에만 집중할수 있도록 &amp;nbsp;백엔드 개발에 관한것을 서비스 해주는 형태입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;따라서 각 서비스의 특징을 확실하게 알아두는것이 추후 개발에 있어 매우 도움이 될것이라 생각됩니다.&lt;/p&gt;&lt;hr class=&quot;tx-hr-border-3&quot; style=&quot;display:block; border: black 0 none; border-top: black 1px dotted; height: 1px&quot;&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;이번 포스팅은 React-typescript를 포스팅 하던 도중, firebase로 사용해보기 위해 공부를 하다가 포스팅을 하게 되었습니다. 막연하게 클라우드 컴퓨팅이라는 단어만 알고 개발을 하는 것보다는 각각의 서비스 유형을 알고 사용하는것이 조금이라도 더 좋지 않을까 라는 생각에 시작하였습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;다음에는 FireBase를 공부, 사용해보고 포스팅을 진행하겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;기본적으로는 위키를 참고하였고, AWS의 클라우드컴퓨팅 문서도 참고하였습니다(&lt;a href=&quot;https://aws.amazon.com/ko/what-is-cloud-computing/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://aws.amazon.com/ko/what-is-cloud-computing/&lt;/a&gt;)&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;또한 ETRI의 문서도 참고 하였습니다. (&lt;a href=&quot;https://ettrends.etri.re.kr/ettrends/pubreader.do?volume=30&amp;amp;issue=4&amp;amp;page=191&amp;amp;paperno=0905002069&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://ettrends.etri.re.kr/ettrends/pubreader.do?volume=30&amp;amp;issue=4&amp;amp;page=191&amp;amp;paperno=0905002069&lt;/a&gt;)&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;감사합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>단일 포스팅</category>
      <category>BaaS</category>
      <category>Cloud Computing</category>
      <category>IaaS</category>
      <category>PaaS</category>
      <category>saas</category>
      <category>클라우드 컴퓨팅</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/42</guid>
      <comments>https://jaroinside.tistory.com/42#entry42comment</comments>
      <pubDate>Thu, 3 Aug 2017 21:08:43 +0900</pubDate>
    </item>
    <item>
      <title>Hoisting - 호이스팅</title>
      <link>https://jaroinside.tistory.com/40</link>
      <description>&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;Hoisting - 호이스팅&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;a href=&quot;http://endic.naver.com/enkrEntry.nhn?entryId=114b49fa02184741bef08323d0cc6cde&quot; target=&quot;_blank&quot; lang=&quot;en&quot; style=&quot;font-family: 새굴림, gulim; color: rgb(0, 0, 255); text-decoration-line: underline; display: inline-block; border-bottom: 0px; font-size: 12px; line-height: 18px;&quot;&gt;&lt;span class=&quot;c_b&quot; lang=&quot;en&quot; style=&quot;border-bottom: 0px; font-size: 13px; color: rgb(0, 0, 204) !important;&quot;&gt;&lt;strong lang=&quot;en&quot; style=&quot;border-bottom: 0px; line-height: 15px;&quot;&gt;hoist&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: 새굴림, gulim;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;fnt_k10&quot; style=&quot;font-family: 굴림; font-size: 12px; color: rgb(119, 119, 119); padding-left: 4px; vertical-align: baseline; border-bottom: none; line-height: 1;&quot;&gt;미국·영국&lt;/span&gt;&lt;span style=&quot;font-family: 새굴림, gulim;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;fnt_e25&quot; style=&quot;font-family: &amp;quot;Lucida Sans Unicode&amp;quot;; font-size: 12px;&quot;&gt;[hɔɪst]&amp;nbsp;&lt;/span&gt;&lt;a playlist=&quot;http://dic.dn.naver.com/v?_lsu_sa_=3898ad58ad6639d63b96f1b33ac4bcf82d1369d598077fa06fb27c784bf663419c59d7fd6a551972697e69f5d02190abe6c1cd3cf84fbf44109288c1746092fd56ce051ea99b23091a2cc29669329610f3bf1a0aabb05b04cf3c84959d27cd68d362321d9ba27e260569ba9e4eb186c0509ce563189660c652c0934d877899f1&quot; class=&quot;play&quot; href=&quot;http://dic.naver.com/search.nhn?dicQuery=hoist&amp;amp;query=hoist&amp;amp;target=dic&amp;amp;ie=utf8&amp;amp;query_utf=&amp;amp;isOnlyViewEE=#&quot; style=&quot;font-family: 새굴림, gulim; position: relative; top: 0px; color: rgb(0, 0, 255); text-decoration-line: underline; display: inline-block; border: 0px; margin-left: 0px; vertical-align: middle; font-size: 12px; line-height: 18px;&quot;&gt;&lt;img alt=&quot;발음 듣기&quot; class=&quot;play&quot; src=&quot;http://sstatic.naver.net/search/dic/btn_listen.gif&quot; style=&quot;border: 0px; position: relative; top: 0px; margin-left: 0px; vertical-align: middle;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: 새굴림, gulim;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;fnt_k10&quot; style=&quot;font-family: 굴림; font-size: 12px; color: rgb(119, 119, 119); padding-left: 4px; vertical-align: baseline; border-bottom: none; line-height: 1;&quot;&gt;영국식&lt;/span&gt;&lt;span style=&quot;font-family: 새굴림, gulim;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a playlist=&quot;http://dic.dn.naver.com/v?_lsu_sa_=3748c95dcd2235366f9dc1a63d64a6f3cdd36425fd024f6f6fb2897f3b1065b1fc5b87f361257f7f597a60f5172d600a51c2848c4c6c9eb239e6ddbe49d2d2c32b9c6b74ef4054b13d0b3f9401002f0d95458b0a3da73812de25b561862bc68ee5fc1d88dca64b253cd6429303750257f2810725440620cc40fd9be92c336bfc&quot; class=&quot;play&quot; href=&quot;http://dic.naver.com/search.nhn?dicQuery=hoist&amp;amp;query=hoist&amp;amp;target=dic&amp;amp;ie=utf8&amp;amp;query_utf=&amp;amp;isOnlyViewEE=#&quot; style=&quot;font-family: 새굴림, gulim; position: relative; top: 0px; color: rgb(0, 0, 255); text-decoration-line: underline; display: inline-block; border: 0px; margin-left: 0px; vertical-align: middle; font-size: 12px; line-height: 18px;&quot;&gt;&lt;img alt=&quot;발음 듣기&quot; class=&quot;play&quot; src=&quot;http://sstatic.naver.net/search/dic/btn_listen.gif&quot; style=&quot;border: 0px; position: relative; top: 0px; margin-left: 0px; vertical-align: middle;&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: 새굴림, gulim;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;dic_grade&quot; style=&quot;font-family: 새굴림, gulim; line-height: 12px; display: inline-block; position: relative; top: -2px; vertical-align: middle; height: 14px;&quot;&gt;&lt;span style=&quot;display: inline-block; height: 14px; background: url(&amp;quot;http://sstatic.naver.net/search/img/bg_grade.gif&amp;quot;) 0px 0px repeat-x; position: relative; top: 2px; width: 10px;&quot;&gt;&lt;span class=&quot;blind&quot; style=&quot;position: relative; overflow: hidden !important; top: 2px; bottom: 14px; width: 1px !important; background: url(&amp;quot;http://sstatic.naver.net/search/img/bg_grade.gif&amp;quot;) 0px 0px repeat-x; display: inline-block; height: 14px;&quot;&gt;중요&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;dd style=&quot;margin: 2px 0px 19px; padding: 0px; line-height: 19px; width: 695px; font-size: 12px; font-family: 새굴림, gulim;&quot;&gt;1. (흔히 밧줄이나 장비를 이용하여) 들어올리다&lt;br /&gt;2. (화물・장애인을 들어올리기 위한) 승강 장치&lt;/dd&gt;&lt;dd style=&quot;margin: 2px 0px 19px; padding: 0px; line-height: 19px; width: 695px; font-size: 12px; font-family: 새굴림, gulim;&quot;&gt;출처: 네이버 어학사전&lt;/dd&gt;&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Glossary/JavaScript&quot; class=&quot;glossaryLink&quot; title=&quot;JavaScript: JavaScript (JS) is a programming language mostly used client-side to dynamically script webpages, but often also server-side.&quot; style=&quot;color: inherit; margin: 0px; padding: 0px; border-top: 0px; border-right: 0px; border-left: 0px; border-bottom-color: rgb(170, 170, 170); border-image: initial; cursor: help; font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;JavaScript&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;에서,&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Glossary/Function&quot; class=&quot;glossaryLink&quot; title=&quot;함수: A function is a code snippet that can be called by other code or by itself, or a variable that refers to the function. When a function is called, arguments are passed to the function as input, and the function can optionally return an output. A function in JavaScript is also an object.&quot; style=&quot;color: inherit; margin: 0px; padding: 0px; border-top: 0px; border-right: 0px; border-left: 0px; border-bottom-color: rgb(170, 170, 170); border-image: initial; cursor: help; font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;함수&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;및&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Glossary/Variable&quot; class=&quot;glossaryLink&quot; title=&quot;변수: A variable is a named location for storing a value. That way an unpredictable value can be accessed through a predetermined name.&quot; style=&quot;color: inherit; margin: 0px; padding: 0px; border-top: 0px; border-right: 0px; border-left: 0px; border-bottom-color: rgb(170, 170, 170); border-image: initial; cursor: help; font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;변수&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;는 끌어올려(&lt;/span&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;hoisted&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;)집니다.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;호이스팅&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;은 선언을&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Glossary/scope&quot; class=&quot;glossaryLink&quot; title=&quot;scope: The current context of execution. The context in which values and expressions are &amp;quot;visible,&amp;quot; or can be referenced. If a variable or other expression is not &amp;quot;in the current scope,&amp;quot; then it is unavailable for use. Scopes can also be layered in a hierarchy, so that child scopes have access to parent scopes, but not vice versa.&quot; style=&quot;color: inherit; margin: 0px; padding: 0px; border-top: 0px; border-right: 0px; border-left: 0px; border-bottom-color: rgb(170, 170, 170); border-image: initial; cursor: help; font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;scope&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;(전역 범위 또는 현재 함수 범위)의 상단으로 이동하는 JavaScript의 행동&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;입니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;아래와 같은 함수가 있습니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;line-height: 18px;&quot;&gt;&lt;span style=&quot;color: rgb(166, 226, 46);&quot;&gt;hoisting&lt;/span&gt;();&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;Open Sans&amp;quot;, arial, x-locale-body, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;이 함수를 실행할 경우 콘솔에는 어떠한 값이 찍힐까요?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;바로&amp;nbsp;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;undefined&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;가 출력됩니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;왜냐하면, 이 함수는 javascript내에서 해석되기를, 함수안에서 생성된 변수 이므로&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;함수의 최상단에서 선언되는것으로 호이스팅 되고, 결과적으로 콘솔을 출력할때에는 변수는 선언만 되어있는 상태이므로 undefined가 출력되는것입니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;즉 아래와 같이 해석됩니다.&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; value;&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;line-height: 18px;&quot;&gt;&lt;span style=&quot;color: rgb(166, 226, 46);&quot;&gt;hoisting&lt;/span&gt;();&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그렇다면 이번에는&amp;nbsp;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; hoisting;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(hoisting);&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이러한 코드가 있을때, 콘솔에 출력되는 값을 무엇일까요?&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;바로&amp;nbsp;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;[Function: hoisting]&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;이 출력됩니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;왜냐하면 변수가 함수 안쪽이 아닌 전역에서 선언되었으므로 최상단으로 호이스팅 되어&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;결과적으로는&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; hoisting;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; value;&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(hoisting);&lt;/div&gt;&lt;/div&gt;&lt;p&gt;이렇게 해석되기 때문입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;하지만 만약에&amp;nbsp;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; hoisting &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting!'&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(hoisting);&lt;/div&gt;&lt;/div&gt;&lt;p&gt;이렇게 변수에 값을 할당할 경우에는&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; hoisting;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; value;&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;hoisting &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'&lt;/span&gt;&lt;span style=&quot;color: rgb(230, 219, 116);&quot;&gt;hoisting!&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(hoisting);&lt;/div&gt;&lt;/div&gt;&lt;p&gt;호이스팅은 되지만 함수 아래에서 다시 변수에 값을 할당하므로&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;콘솔에는 hoisting! 이 출력됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이러한 호이스팅은 신경쓰지 않으면 버그 생성등의 문제가 발생할수 있으므로 주의하여야 합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* 다만, es6의 let, const를 사용한다면 자동적으로 호이스팅 문제는 해결됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(value);&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;let&lt;/span&gt; value &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'hoisting'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #a6e22e;&quot;&gt;hoisting&lt;/span&gt;();&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이 코드는 실행되지 않고 에러를 출력합니다.&lt;/p&gt;&lt;p&gt;왜냐하면 호이스팅이 일어나지 않으므로 console.log는 value가 무엇인지 알지 못하기 때문입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;역시 전역에서도 마찬가지로 호이스팅은 일어나지 않습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;결론은.... 음.. 호이스팅에 대해 기억하고 let, const를 잘 사용하자?? 입니다 :)&lt;/p&gt;</description>
      <category>Javascript</category>
      <category>hoisting</category>
      <category>JavaScript</category>
      <category>호이스팅</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/40</guid>
      <comments>https://jaroinside.tistory.com/40#entry40comment</comments>
      <pubDate>Thu, 3 Aug 2017 04:55:21 +0900</pubDate>
    </item>
    <item>
      <title>14.mobx-part3</title>
      <link>https://jaroinside.tistory.com/39</link>
      <description>&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;@computed&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;getter함수에만 사용이 가능한, @&lt;/span&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;observable&lt;/span&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;과 유사한 기능을 갖습니다.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;* Javascript es6 의 getter를 모르시는 분들은 이곳을 참고해 주세요.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Functions/get&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Functions/get&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;하지만 observable과 가장 큰 차이점은 최적화의 문제입니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;observable은 값이 변경될때마다 무조건 렌더링을 다시 하지만,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;실제 사용할 값을 computed해놓고 사용한다면, observable값이 변경되더라도, computed 에 명시된 값에 부합하지 않다면, 재 렌더링 하지 않습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;사용법은 역시 함수로 사용하는 방법과 데코레이터를 사용하는 방법이 존재합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이번포스팅에서 부터는 함수로 사용하는 방법에 대해서는 예제를 만들지 않겠습니다.&lt;/p&gt;&lt;p&gt;( 거의 사용 하지 않습니다. 특히 타입스크립트에서는.. )&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;데코레이터를 사용하는 예제를 작성해 보도록 하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이전에 사용하던 프로젝트의 AgeStore.tsx 파일에 computed를 추가하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observable, computed } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    @observable &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;private&lt;/span&gt; _age&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    @computed&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;get&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;age&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;40&lt;/span&gt;) &lt;span style=&quot;color: #f92672;&quot;&gt;?&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;)&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;만약 this._age가 40이 넘는다면 렌더링을 하고 그렇지 않으면 0을 렌더링 할것입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그리고 age 컴포넌트를 변경하겠습니다.&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.age}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이전에는 getAge() 를 렌더링 했지만 이번에는 computed로 지정한 age를 렌더링 합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;실행해 보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/996B763359820E1603&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F996B763359820E1603&quot; width=&quot;500&quot; height=&quot;227&quot; filename=&quot;스크린샷 2017-08-03 오전 2.37.57.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;실행하였을때 0이 나오는것을 볼수 있습니다.&lt;/p&gt;&lt;p&gt;왜냐하면 실행하였을때 this._age의 값은 30이니까요.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;여기서&amp;nbsp;나이증가 버튼을 계속 누르다 보면,&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/995D1B3359820E2703&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F995D1B3359820E2703&quot; width=&quot;500&quot; height=&quot;206&quot; filename=&quot;스크린샷 2017-08-03 오전 2.38.06.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; 짠 렌더링이 실시됩니다.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;즉 this._age값은 계속 변화하였지만 computed로 인해 렌더링이 되지 않고 값만 변화하였다가&lt;/p&gt;&lt;p&gt;40이 넘어가는 순간부터 렌더링을 실시하게 된것입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예제에서는 단순하게 하였지만, 좀더 정밀하게 구성한다면, 렌더링을 최적화 하는데 매우 큰 도움이 될것으로 예상됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* 만약 setter 함수를 사용하여 값을 변화시키고, 같은 이름의 getter 함수를 computed 해놓았다면,&lt;/p&gt;&lt;p&gt;setter 함수 호출후에는 반드시 getter 함수가 호출됩니다.&amp;nbsp;&lt;/p&gt;&lt;p&gt;하지만 이때 반드시 getter 함수 정의후 setter 함수를 정의 하여야 합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;a href=&quot;https://mobx.js.org/refguide/computed-decorator.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://mobx.js.org/refguide/computed-decorator.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;b&gt;@action -&amp;nbsp;&lt;span style=&quot;font-size: 8pt;&quot;&gt;추후에 내용을 보강할 계획입니다.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;action은 state를 수정하는 함수입니다. ( observable이 있는 프로퍼티를 수정 )&lt;/p&gt;&lt;p&gt;옵셔널한 기능이므로 사용해도, 안해도 됩니다.&lt;/p&gt;&lt;p&gt;하지만 mobx의 use-strict 모드를 사용한다면, state를 변경하는 함수에는 반드시 사용해야 합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예시로 살펴보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;우선 src/index.tsx에 use-strict 모드를 적용하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; ReactDOM &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react-dom'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { App } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./containers'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; registerServiceWorker &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./registerServiceWorker'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./index.css'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { useStrict } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #a6e22e;&quot;&gt;useStrict&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;ReactDOM.&lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;(&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;App&lt;/span&gt; /&amp;gt;,&lt;/div&gt;&lt;div&gt;  document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'root'&lt;/span&gt;) &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;HTMLElement&lt;/span&gt;&lt;/div&gt;&lt;div&gt;);&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #a6e22e;&quot;&gt;registerServiceWorker&lt;/span&gt;();&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그리고 실행하면 컴파일에서는&amp;nbsp;오류가 전혀 발생하지 않습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그러나 실행화면에서 버튼을 눌러 state를 변경하려고 하는 순간&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99D38E3359820D1901&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99D38E3359820D1901&quot; width=&quot;500&quot; height=&quot;397&quot; filename=&quot;스크린샷 2017-08-03 오전 2.33.43.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;에러를 발생시킵니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;대충 봐도 action을 쓰라고 써있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그렇다면 action 을 사용해야겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;AgeStore.tsx 파일에 적용하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; color: rgb(249, 38, 114);&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt;observable&lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt;computed&lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt; } &lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; color: rgb(249, 38, 114);&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; color: rgb(230, 219, 116);&quot;&gt;'mobx'&lt;/span&gt;&lt;span style=&quot;background-color: rgb(39, 40, 34); color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    @observable &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;private&lt;/span&gt; _age&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    @computed&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;get&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;age&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;40&lt;/span&gt;) &lt;span style=&quot;color: #f92672;&quot;&gt;?&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    @action&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;)&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;간단하게 observable된 프로퍼티 값을 바꾸는 함수에 @action을 추가하면 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;a href=&quot;https://mobx.js.org/refguide/action.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://mobx.js.org/refguide/action.html&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;@inject와 Provider&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;이전에 Redux에서 쓰던 Provider와 똑같이 사용합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;다른점은, 이전에 redux에서는 provider로 넘긴 props를 사용하기 위해서는&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;컴포넌트를 컨네이터로 감싼뒤&amp;nbsp;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;mapStateToProps,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;mapDispatchToProps를 작성하여 사용가능하게 만들었습니다. 하지만 mobx에서는 @inject 선언으로 사용이 가능합니다. 심플하게..&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;예제를 만들어 보겠습니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;src/index.tsx&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; ReactDOM &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react-dom'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { App } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./containers'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; registerServiceWorker &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./registerServiceWorker'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./index.css'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { useStrict } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { Provider } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx-react'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #a6e22e;&quot;&gt;useStrict&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; ageState &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;ReactDOM.&lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;(&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;Provider&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;store&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; {ageState}&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;App&lt;/span&gt; /&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;Provider&lt;/span&gt;&amp;gt;,&lt;/div&gt;&lt;div&gt;  document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'root'&lt;/span&gt;) &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;HTMLElement&lt;/span&gt;&lt;/div&gt;&lt;div&gt;);&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #a6e22e;&quot;&gt;registerServiceWorker&lt;/span&gt;();&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;AgeStore를 Provider를 통해 props로 내려주겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그리고 Age 컴포넌트에서 사용해 보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;src/components/Age.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observer, inject } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx-react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #a6e22e;&quot;&gt;inject&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'store'&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;@observer&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{ store&lt;span style=&quot;color: #f92672;&quot;&gt;?:&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;; }, {}&amp;gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentWillReact&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentWillReact'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentWillUpdate&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentWillUpdate'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentDidUpdate&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentDidUpdate'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'render'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; store &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.props.store &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{store.age}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; store.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;정말 간단하게 @inject('store') 명령으로 가져오는것이 가능합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;하지만 여기서 중요한것은 typescript이므로 props의 타입을 지정해줘야 하는데&amp;nbsp;&lt;/p&gt;&lt;p&gt;stroe를 타입으로 지정해주면 됩니다.&lt;/p&gt;&lt;p&gt;또한 사용하기 위해서는&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; store &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.props.store &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;;&lt;/div&gt;&lt;p&gt;처럼 명시해주어야 사용이 가능합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* 저는 이번 예제를 좀더 깔끔하게 사용 하기 위해 addAge함수를 store에 넣었습니다.&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observable, computed, action } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    @observable &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;private&lt;/span&gt; _age&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    @computed&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;get&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;age&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;40&lt;/span&gt;) &lt;span style=&quot;color: #f92672;&quot;&gt;?&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    @action&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;)&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    @action&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;autorun&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;autorun은 observers 자체를 가지지 않는 리액션 함수를 만들고자하는 경우에 사용할 수 있습니다.&amp;nbsp;&lt;/p&gt;&lt;p&gt;일반적으로 로깅, 지속성 또는 UI 업데이트 코드와 같이 반응적인 코드에서 명령형 코드로 연결해야하는 경우입니다. autorun과 computed는 비슷하게 보이지만, 완전히 다르게 동작합니다.&lt;/p&gt;&lt;p&gt;autorun을 사용하면, 종속성 중 하나가 변경 될 때마다 무조건 다시 트리거 되는 반면에,&lt;/p&gt;&lt;p&gt;computed는 상황에 따라 트리거 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;따라서 자동으로 실행되어야 하지만, 새로운 값을 결과로 내놓지 않는 함수가 있다면 autorun을 사용하고, 그렇지 않다면 computed를 사용하는 것이 좋습니다.&lt;/p&gt;&lt;p&gt;* 그래서 autorun 은 거의 대부분 로그를 출력하는데 이용됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예제를 통해 살펴보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;src/stores/AgeStore.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observable, computed, action, autorun } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    @observable &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;private&lt;/span&gt; _age&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    @computed&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;get&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;age&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;40&lt;/span&gt;) &lt;span style=&quot;color: #f92672;&quot;&gt;?&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    @action&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;)&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    @action&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;ageLog&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Function&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;autorun&lt;/span&gt;(() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #f92672;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;() &lt;span style=&quot;color: #f92672;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;50&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;                window.&lt;span style=&quot;color: #66d9ef;&quot;&gt;alert&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'나이가 너무 많아'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;            &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'Age'&lt;/span&gt;, &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;age 로그라는 함수를 만들어&amp;nbsp;autorun 함수를 return 하게 하였습니다.&lt;/p&gt;&lt;p&gt;여기서는 getAge하였는데 그 값이 50 이상일 경우에는 경고창을 띄우도록 하였고,&lt;/p&gt;&lt;p&gt;그렇지 않으면 콘솔을 띄우도록 하였습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;src/components/Age.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observer, inject } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx-react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@&lt;span style=&quot;color: #a6e22e;&quot;&gt;inject&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'store'&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;@observer&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{ store&lt;span style=&quot;color: #f92672;&quot;&gt;?:&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;; }, {}&amp;gt; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #f92672;&quot;&gt;private&lt;/span&gt; store &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.props.store &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.store.&lt;span style=&quot;color: #a6e22e;&quot;&gt;ageLog&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentWillReact&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentWillReact'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentWillUpdate&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentWillUpdate'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentDidUpdate&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentDidUpdate'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'render'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.store.age}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.store.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그리고 Age컴포넌트에서는 생성자 함수에서 ageLog를 실행하도록 하였습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;프로젝트를 실행해보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99C5AB3359821E081D&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99C5AB3359821E081D&quot; width=&quot;500&quot; height=&quot;178&quot; filename=&quot;스크린샷 2017-08-03 오전 3.45.29.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99C5B73359821E091D&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99C5B73359821E091D&quot; width=&quot;500&quot; height=&quot;280&quot; filename=&quot;스크린샷 2017-08-03 오전 3.45.38.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left; clear: none; float: none;&quot;&gt;실행후 버튼을 누르면, age가 50이 되기 전까지는 증가된 값이 그냥 콘솔만 표시됩니다.&lt;/p&gt;&lt;p style=&quot;text-align: left; clear: none; float: none;&quot;&gt;( 물론 이전에 computed때문에 렌더링은 되지 않습니다.)&lt;/p&gt;&lt;p style=&quot;text-align: left; clear: none; float: none;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/99CB453359821E0A1C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F99CB453359821E0A1C&quot; width=&quot;500&quot; height=&quot;271&quot; filename=&quot;스크린샷 2017-08-03 오전 3.45.49.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;하지만 50이 넘어가는 순간 경고창을 띄웁니다.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이런식으로 autorun을 사용하게 되는데, 경고창이 아닌 에러를 발생시켜 다른 작업을 할수도 있고,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;활용법은 많을것으로 예상됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;a href=&quot;https://mobx.js.org/refguide/autorun.html&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://mobx.js.org/refguide/autorun.html&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;이번 포스팅까지가 mobx의 포스팅였습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;아마 다음 포스팅까지는 조금 시간이 걸릴듯 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;남은 포스팅은 todoApp 예제와, react 서버사이드 렌더링 구현, &amp;nbsp;테스팅, nextjs 가 남아있는데,&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;그 전에 선수지식이 필요할듯 하여 좀더 공부를 한 뒤 포스팅을 할 예정입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;빠르게 공부하여 다시 react-typescript의 포스팅을 이어가도록 하겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;감사합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;이번 포스팅의 소스코드입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://github.com/JaroInside/tistory-react-typescript-study/tree/14.mobx-part3&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://github.com/JaroInside/tistory-react-typescript-study/tree/14.mobx-part3&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;hr class=&quot;tx-hr-border-2&quot; style=&quot;display:block; border: black 0 none; border-top: black 1px solid; border-bottom: black 3px solid; height: 7px&quot;&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;참고 슬라이드 -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;http://slides.com/woongjae/react-with-typescript-&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;4&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-3#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;#/&lt;/a&gt;&lt;/span&gt;&lt;br style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;참고 동영상 -&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.youtube.com/playlist?list=PLV6pYUAZ-ZoHx0OjUduzaFSZ4_cUqXLm0&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background: rgb(241, 241, 241); color: ivory; transition: all 0.3s; font-size: 14px; padding: 1px; font-family: &amp;quot;Ubuntu Condensed&amp;quot;, &amp;quot;Noto Sans Korean&amp;quot;;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 14pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;https://www.youtube.com/playlist?list=PLV6pYUAZ-ZoHx0OjUduzaFSZ4_cUqXLm0&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description>
      <category>React/React&amp;amp;typeScript</category>
      <category>mobx</category>
      <category>React</category>
      <category>TypeScript</category>
      <category>리액트</category>
      <category>몹엑스</category>
      <category>타입스크립트</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/39</guid>
      <comments>https://jaroinside.tistory.com/39#entry39comment</comments>
      <pubDate>Thu, 3 Aug 2017 03:52:56 +0900</pubDate>
    </item>
    <item>
      <title>14.mobx-part2</title>
      <link>https://jaroinside.tistory.com/38</link>
      <description>&lt;p&gt;이전포스팅에서 간단하게 mobx를 사용해보았습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이번 포스팅에서는 mobx에 있는 여러 기능들에 대해 알아보는 포스팅을 해보도록 하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;observable&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;observable은 관찰하고자 하는 값에 사용합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;obsevable을 사용하는 방법에는 2가지가 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;1. 일반 function 으로 사용&lt;/p&gt;&lt;p&gt;2. 데코레이터로 사용&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;일반 function 으로 사용하는것은 매우 간단하게 사용이 가능합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이전 포스팅에서 사용한 프로젝트를 재 사용하여 예제를 만들어 보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;stores 폴더에 AgeStore2.tsx 파일을 만들고 함수형태의 observable을 사용해 보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observable } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; Age2 &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;observable&lt;/span&gt;({&lt;/div&gt;&lt;div&gt;    age: &lt;span style=&quot;color: #ae81ff;&quot;&gt;35&lt;/span&gt;&lt;/div&gt;&lt;div&gt;});&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age2;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그냥 관찰하고자 하는 값에 observable 함수를 사용하기만 하면 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;stores/index.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; AgeStore &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./AgeStore'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; Age2 &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./AgeStore2'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; { AgeStore, Age2 };&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그리고 Age 컴포넌트에서 사용해보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore, Age2 } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observer } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx-react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; ageState &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@observer&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{}, {}&amp;gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge.&lt;span style=&quot;color: #a6e22e;&quot;&gt;bind&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addNumber &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addNumber.&lt;span style=&quot;color: #a6e22e;&quot;&gt;bind&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{Age2.age}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addNumber&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;    ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;addNumber&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    Age2.age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; Age2.age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이전 코드에서 Age2를 추가하고, 이벤트 핸들러를 추가한다음, 적용시켰습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/211CD733597F617E38&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F211CD733597F617E38&quot; width=&quot;500&quot; height=&quot;172&quot; filename=&quot;스크린샷 2017-08-01 오전 1.57.16.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이상없이 작동하는것을 확인할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;데코레이터로 사용하는 방법은 이미 사용해보았기 때문에 사용 방법은 아실거라 생각합니다.&lt;/p&gt;&lt;p&gt;다만 기억하실점은, 데코레이터로 사용을 하신다면, 반드시 클래스의 프로퍼티에만 사용이 가능함을 기억하셔야 합니다.&lt;/p&gt;&lt;p&gt;다른곳에서는 사용이 불가합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;만약 여러 프로퍼티를 사용한다면 여러개의 observable을 사용하면 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;observer&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;observer는&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;observable된 값 변화에 따라 반응하는 컴포넌트에 사용합니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;역시 observable과 같이 사용하는 방법에는&amp;nbsp;2가지 방식이 존재합니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;font color=&quot;#333333&quot; face=&quot;KoPub Dotum&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;1. 데코레이터 없이 사용하는 방법&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color=&quot;#333333&quot; face=&quot;KoPub Dotum&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;2. 데코레이터로 사용하는 방법&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color=&quot;#333333&quot; face=&quot;KoPub Dotum&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color=&quot;#333333&quot; face=&quot;KoPub Dotum&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;데코레이터 없이 사용하는 방법은&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;observer(&amp;lt;컴포넌트&amp;gt;); 의 형식으로 사용하면 됩니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 10pt;&quot;&gt;만약 state를 전혀 사용하지 않는 컴포넌트일 경우, 일반적으로는 stateless component, 즉 SFC를 사용하였는데, mobx를 사용할 경우에는 SFC 대신&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;observer를 사용하면 됩니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;즉 이전 예제의 Age 컴포넌트를&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; Age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;observer&lt;/span&gt;(() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;    ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;addNumber&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    Age2.age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; Age2.age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{Age2.age}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;addNumber&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  );&lt;/div&gt;&lt;div&gt;});&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이렇게 사용이 가능합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;데코레이터를 사용할 경우에는 컴포넌트 클래스의 상단에 사용하면 되는데,&lt;/p&gt;&lt;p&gt;만약 observer 데코레이터를 사용할 경우에는 주의할 점이 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;바로 Lifecycle이 mobx의 라이프 사이클로 바뀐다는 점입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이전에 Lifecycle 포스팅에서 (&amp;nbsp;&lt;a href=&quot;http://jaroinside.tistory.com/18&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://jaroinside.tistory.com/18&lt;/a&gt; ) react의 update lifecycle은&amp;nbsp;&lt;/p&gt;&lt;li style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px; border: none; margin: 0px 0px 0px 20px; padding: 0px; line-height: 20px;&quot;&gt;&lt;a href=&quot;https://facebook.github.io/react/docs/react-component.html#componentwillreceiveprops&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(192, 91, 77); transition: color 0.2s ease-in-out; border: none; margin: 0px; padding: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;componentWillReceiveProps(nextProps)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px; border: none; margin: 10px 0px 0px 20px; padding: 0px; line-height: 20px;&quot;&gt;&lt;a href=&quot;https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(192, 91, 77); transition: color 0.2s ease-in-out; border: none; margin: 0px; padding: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;shouldComponentUpdate(nextProps, nextState)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px; border: none; margin: 10px 0px 0px 20px; padding: 0px; line-height: 20px;&quot;&gt;&lt;a href=&quot;https://facebook.github.io/react/docs/react-component.html#componentwillupdate&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(192, 91, 77); transition: color 0.2s ease-in-out; border: none; margin: 0px; padding: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;componentWillUpdate(&lt;/code&gt;&lt;/a&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;&lt;a href=&quot;https://facebook.github.io/react/docs/react-component.html#shouldcomponentupdate&quot; style=&quot;box-sizing: border-box; background-color: rgb(249, 249, 249); color: rgb(192, 91, 77); transition: color 0.2s ease-in-out; border: none; font-family: proxima-nova, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Roboto, Arial, sans-serif; font-size: medium; margin: 0px; padding: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;nextProps, nextState&lt;/code&gt;&lt;/a&gt;)&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px; border: none; margin: 10px 0px 0px 20px; padding: 0px; line-height: 20px;&quot;&gt;&lt;a href=&quot;https://facebook.github.io/react/docs/react-component.html#render&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(192, 91, 77); transition: color 0.2s ease-in-out; border: none; margin: 0px; padding: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;render()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px; border: none; margin: 10px 0px 0px 20px; padding: 0px; line-height: 20px;&quot;&gt;&lt;a href=&quot;https://facebook.github.io/react/docs/react-component.html#componentdidupdate&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(192, 91, 77); transition: color 0.2s ease-in-out; border: none; margin: 0px; padding: 0px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: source-code-pro, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; padding: 1px 3px; color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 4px; border: none; margin: 0px; line-height: 1.5; text-size-adjust: none;&quot;&gt;componentDidUpdate(prevProps, prevState)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이렇게 5개의 라이프 사이클이 존재하고 순서대로 작동한다고 하였습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;하지만 observer 데코레이터를 사용하면 라이프사이클은,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;- componentWillReact&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;- componentWillUpdate&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;- rend&lt;/span&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;er&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;- componentDidUpdate&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 0, 0);&quot;&gt;&lt;b&gt;&lt;/b&gt;의 순서로 실행되게 됩니다. ( 주의 ! )&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 0, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 0, 0);&quot;&gt;- 확인을 위한 코드 -&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore, Age2 } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observer } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx-react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; ageState &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@observer&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{}, {}&amp;gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge.&lt;span style=&quot;color: #a6e22e;&quot;&gt;bind&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addNumber &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addNumber.&lt;span style=&quot;color: #a6e22e;&quot;&gt;bind&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentWillReact&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentWillReact'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentWillUpdate&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentWillUpdate'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;componentDidUpdate&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'componentDidUpdate'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'render'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{Age2.age}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addNumber&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;    ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;addNumber&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    Age2.age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; Age2.age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 0, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/21395333597F67762A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F21395333597F67762A&quot; width=&quot;500&quot; height=&quot;267&quot; filename=&quot;스크린샷 2017-08-01 오전 2.22.36.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/26388533597F67772A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F26388533597F67772A&quot; width=&quot;500&quot; height=&quot;200&quot; filename=&quot;스크린샷 2017-08-01 오전 2.22.41.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 0, 0);&quot;&gt;- 첫번째 render 는 첫 render 입니다 -&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 14pt; color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;font-size: 10pt; color: rgb(0, 0, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이번 포스팅은 조금 짧게 하였습니다.&lt;/p&gt;&lt;p&gt;다음 포스팅에서는 이전 예제에서 다뤄보지 않은 computed, &amp;nbsp;action, inject, provider등을 포스팅 하겠습니다.&lt;/p&gt;&lt;p&gt;감사합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;소스코드 주소입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/JaroInside/tistory-react-typescript-study/tree/14.mobx-part2&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://github.com/JaroInside/tistory-react-typescript-study/tree/14.mobx-part2&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;hr class=&quot;tx-hr-border-2&quot; style=&quot;display:block; border: black 0 none; border-top: black 1px solid; border-bottom: black 3px solid; height: 7px&quot;&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;참고 슬라이드 -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;http://slides.com/woongjae/react-with-typescript-&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;4&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-3#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;#/&lt;/a&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;참고 동영상 -&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.youtube.com/playlist?list=PLV6pYUAZ-ZoHx0OjUduzaFSZ4_cUqXLm0&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background: rgb(241, 241, 241); color: ivory; transition: all 0.3s; font-size: 14px; padding: 1px; font-family: &amp;quot;Ubuntu Condensed&amp;quot;, &amp;quot;Noto Sans Korean&amp;quot;;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 14pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;https://www.youtube.com/playlist?list=PLV6pYUAZ-ZoHx0OjUduzaFSZ4_cUqXLm0&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description>
      <category>React/React&amp;amp;typeScript</category>
      <category>mobx</category>
      <category>React</category>
      <category>TypeScript</category>
      <category>리액트</category>
      <category>몹엑스</category>
      <category>타입스크립트</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/38</guid>
      <comments>https://jaroinside.tistory.com/38#entry38comment</comments>
      <pubDate>Tue, 1 Aug 2017 02:05:35 +0900</pubDate>
    </item>
    <item>
      <title>자바스크립트 이벤트 - Javascript Event</title>
      <link>https://jaroinside.tistory.com/37</link>
      <description>&lt;p&gt;&lt;span style=&quot;font-size: 32px;&quot;&gt;&lt;b&gt;이벤트&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 32px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;이벤트는 키보드로 키를 입력하거나, 마우스 클릭과 같이 다른 것에 영향을 미치는 것을 의미합니다. 이벤트는 사용자가 발생시킬수도 있고, application 스스로 발생시킬 수도 있습니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;이벤트 관련 용어&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:24pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;&lt;b&gt;&lt;/b&gt;이벤트 연결, 이벤트 이름, 이벤트 속성, 이벤트 핸들러, 이벤트 모델&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:24pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:24pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;예시를 사용하여 살펴보겠습니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:24pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;간단하게 index.html 파일을 생성하고, 코드를 작성해주세요.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div style=&quot;line-height: 18px;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#EventDom&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;EventDom&quot;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      window.onload &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; whenLoad;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;whenLoad&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #75715e;&quot;&gt;// 변수 선언&lt;/span&gt;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;let&lt;/span&gt; dom &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'EventDom'&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        &lt;span style=&quot;color: #75715e;&quot;&gt;// 이벤트 연결&lt;/span&gt;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;whenClick&lt;/span&gt;() { &lt;span style=&quot;color: #a6e22e;&quot;&gt;alert&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'CLICK'&lt;/span&gt;); };&lt;/div&gt;&lt;div&gt;        dom.onclick &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; whenClick;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;화면에 가로 500px, 세로 500px 의 dom 을 생성하고, EventDom 이라는 id를 부여하였습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;한번 index.html을 브라우져로 열어 클릭하여 확인해보시기 바랍니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 11pt;&quot;&gt;이벤트 연결&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;여기서 이벤트 연결은 총 2가지 입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;첫번째는 winodw의 onload 속성에 이벤트를 연결하였고, 두번째는 dom의 onclick 속성에 이벤트를 연결하였습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;이벤트 이름&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;이벤트 연결이 2가지 이므로 이름 또한 2가지가 존재합니다.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;window객체의 경우에는 load, dom 객체의 경우에는 click이 이벤트 이름이 됩니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;이벤트 속성&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;이벤트 연결에서 언급하였듯, 이벤트를 연결하는 객체의 속성을 이벤트 속성이라고 합니다.&lt;/p&gt;&lt;p&gt;window에서는 onload, dom에서는 onclick 이 이벤트 속성입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;이벤트 핸들러&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;window 객체의 onload에서의 이벤트 핸들러는 whenLoad 입니다.&lt;/p&gt;&lt;p&gt;dom 객체의 onclick에서의 이벤트 핸들러는 whenClick입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;즉 이벤트 핸들러는 이벤트가 일어났을때 이벤트에 따라 작업을 하게 하는 객체 혹은 함수를 의미합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;이벤트 모델&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;문서 객체에 이벤트를 연결하는 방법을 이벤트 모델이라고 합니다.&lt;/p&gt;&lt;p&gt;이벤트 모델은 DOM level 단계에 따라 두가지로 분류할수 있으며, 각기 두가지로 또 나뉩니다.&lt;/p&gt;&lt;p&gt;즉 총 4가지의 방법으로 이벤트를 연결할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;* DOM Level 0&lt;/p&gt;&lt;p style=&quot;margin-left: 4em;&quot;&gt;- 고전 이벤트 모델&lt;/p&gt;&lt;p style=&quot;margin-left: 4em;&quot;&gt;- 인라인 이벤트 모델&lt;/p&gt;&lt;p style=&quot;margin-left: 2em;&quot;&gt;* DOM Level 2&lt;/p&gt;&lt;p style=&quot;margin-left: 4em;&quot;&gt;- 마이크로소프트 인터넷 익스플로러 이벤트 모델&lt;/p&gt;&lt;p style=&quot;margin-left: 4em;&quot;&gt;- 표준 이벤트 모델&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;위 예제에서 사용한 방법은 자바스크립트에서 문서 객체의 이벤트 속성을 사용해 이벤트를 연결하는 방법으로, DOM Level0 의 &lt;b&gt;고전 이벤트 모델&lt;/b&gt;입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;인라인 이벤트 모델은 HTML 페이지의 가장 기본적인 이벤트 연결방법으로, 위 예제의 dom click 이벤트를&amp;nbsp;인라인 이벤트 방식으로 바꿔보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#EventDom&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;whenClick&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;) { &lt;span style=&quot;color: #a6e22e;&quot;&gt;alert&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'CLICK'&lt;/span&gt;); };&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;EventDom&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onclick&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;whenClick(event)&quot;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* script를 head에 포함시킨 이유는, 아래에 넣을경우, EventDom이 생성될때 onclick에 whenClick이 아직 명시되지 않은 상태이므로 원하는대로 이벤트가 바인딩 되지 않습니다.&lt;/p&gt;&lt;p&gt;따라서 head에 넣어주어야 정상적으로 작동하게 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예제와 같은 방법으로, 태그의 이벤트 속성에 인라인 형식으로 이벤트를 연결하는 방식을 &lt;b&gt;인라인 이벤트 모델&lt;/b&gt;이라고 합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;한번 index.html을 브라우져로 열어 클릭하여 확인해보시기 바랍니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;DOM Level0 의 두 이벤트 모델은 한번에 하나의 이벤트 핸들러만 가질수 있는 단점이 있습니다.&lt;/p&gt;&lt;p&gt;이러한 단점을 보완하기 위해 만들어진 이벤트 모델이 DOM Level 2 이벤트 모델로써,&amp;nbsp;&lt;/p&gt;&lt;p&gt;마이크로 소프트 익스플로러 모델과 표준 이벤트 모델이 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;하지만 마이크로 소프트 익스플로러 모델의 경우 ie 10까지만 지원하고 11 부터는 표준 이벤트 모델과 동일한 함수를 사용합니다. 따라서 마이크로 소프트 익스플로러 모델은 낮은 버젼의 웹 개발을 하는 경우가 아니라면 굳이 신경쓰지 않아도 될거 같습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;표준 이벤트 모델은 웹 표준을 만드는 W3C에서 공식적으로 지정한 이벤트 모델입니다.&lt;/p&gt;&lt;p&gt;역시 여러 이벤트 핸들러를 추가할수 있으며, 이벤트 캡쳐링을 지원합니다.&lt;/p&gt;&lt;p&gt;( 표준 이벤트 모델은 익스플로러 9부터 지원합니다.)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;표준 이벤트 모델에서의 이벤트 연결, 제거 시에는 아래와 같은 메서드를 사용합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;addEventListener(eventName, handler, useCapture)&lt;/p&gt;&lt;p&gt;removeEventListener(eventName, handler)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예제로 만들어 보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#EventDom&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;EventDom&quot;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      window.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'load'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;let&lt;/span&gt; dom &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'EventDom'&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        dom.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt; , &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'클릭'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;        dom.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt; , &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;          dom.style.backgroundColor&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;blue&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;        dom.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt; , &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #a6e22e;&quot;&gt;alert&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'클릭'&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;      });&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;addEventListener를 이용하여 EventDom 클릭시 3개의 이벤트가 발생하도록 하였습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;만약 이전의 고전 이벤트 모델처럼 이벤트 핸들러를 작성하고&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt;dom&lt;/span&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34); color: rgb(249, 38, 114);&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt;whenClick&lt;/span&gt;&lt;span style=&quot;color: rgb(248, 248, 242); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; white-space: pre; background-color: rgb(39, 40, 34);&quot;&gt;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;과 같은 방식으로 이벤트를 여러번 연결한다면,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;가장 마지막에 연결한 이벤트만 연결되겠지만, 표준 이벤트 모델을 이용한다면 여러 이벤트를 연결할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;이벤트 전달&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;이벤트 전달이란, Dom이 여러개일때, 어떠한 이벤트가 먼저 발생해 어떤순서로 발생하는지 정하는것을 의미합니다.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이벤트 전달방식에는 2가지 방식이 존재합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;b&gt;1. 이벤트 캡쳐링&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;이벤트 캡쳐링은 이벤트의 흐름이 상위노드에서 하위 노드로 흘러가는것을 의미합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;즉 어느 한 Dom에 이벤트가 발생하면 그 Dom이 속한 최상위 노드에서부터 이벤트가 실행되어 실제 이벤트가 발생한 Dom까지 순차적으로 이벤트가 발생하는 구조입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;사용법은 addEventListener(eventName, handler, useCapture) 에서 useCapture를 true로 해주시면 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예제를 통해 알아보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: rgb(249, 38, 114);&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandParent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Parent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;orange&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Me&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;yellow&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Child&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;green&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandChild&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;blue&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;            &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      window.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'load'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(){&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; GrandParent, Parent, Me, Child, GrandChild;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Parent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Me &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Child &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        GrandChild &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: rgb(253, 151, 31); font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        }, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Parent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: rgb(253, 151, 31); font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        }, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Me.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: rgb(253, 151, 31); font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        }, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Child.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: rgb(253, 151, 31); font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        }, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandChild.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: rgb(253, 151, 31); font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        }, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;      });&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이 코드는 5개의 사각형이 존재하며 최상위에는 GrandParent가 존재하고,&amp;nbsp;&lt;/p&gt;&lt;p&gt;가장 아래에는 GrandChild가 존재합니다. 각각 click하였을때, 콘솔로 자신의 id를 표시하게 만들었습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;만약 이 상태에서 Me, 즉 노란색 부분을 클릭하게 되면 이벤트는 어떤 순서로 발생이 되는지 해보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/2460F633597F352D0B&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F2460F633597F352D0B&quot; width=&quot;500&quot; height=&quot;257&quot; filename=&quot;스크린샷 2017-07-31 오후 10.47.51.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/24336B33597F352E2C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F24336B33597F352E2C&quot; width=&quot;500&quot; height=&quot;213&quot; filename=&quot;스크린샷 2017-07-31 오후 10.47.55.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;노란색 부분, 즉 Me Dom을 클릭을 하였는데, 상위 노드의 이벤트부터 차례대로 실행되는것을 확인할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;즉&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;document -&amp;gt; html -&amp;gt; body -&amp;gt; GrandParent -&amp;gt; Parent -&amp;gt; Me 의 순서로 이벤트가 발생하였지만&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;document , html , body 에는 클릭 이벤트가 없으므로 GrandParent 부터 콘솔에 나타난것입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* 인터넷 익스플로러는 캡쳐링을 지원하지 않습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;font-size: 16px;&quot;&gt;2. 이벤트 버블링&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;이번에는 이벤트 버블링을 살펴보겠습니다.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;이벤트 버블링은&amp;nbsp;&lt;/span&gt;&amp;nbsp;이벤트의 흐름이 하위 노드에서 상위&amp;nbsp;노드로 흘러가는것을 의미합니다.&lt;/p&gt;&lt;p&gt;즉 어느 한 Dom에 이벤트가 발생하면 그 Dom에서부터 이벤트가 시작하여 Dom이 속한 최상위 노드까지&amp;nbsp;이벤트가 실행되는 구조입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;예제입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: rgb(249, 38, 114);&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandParent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Parent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;orange&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Me&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;yellow&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Child&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;green&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandChild&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;blue&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;            &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      window.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'load'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(){&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; GrandParent, Parent, Me, Child, GrandChild;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Parent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Me &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Child &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        GrandChild &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Parent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Me.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        }, &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Child.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandChild.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;      });&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;addEventListener(eventName, handler, useCapture) 에서 useCapture를 쓰지 않으면 버블링이 적용됩니다. ( default가 false)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/2282CA33597F373D3C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F2282CA33597F373D3C&quot; width=&quot;500&quot; height=&quot;270&quot; filename=&quot;스크린샷 2017-07-31 오후 10.56.50.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/25D10C33597F373D19&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F25D10C33597F373D19&quot; width=&quot;500&quot; height=&quot;204&quot; filename=&quot;스크린샷 2017-07-31 오후 10.56.55.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;위의 스크린샷은 실행후 파란색 사각형, GrandChild를 클릭했을때 일어난 이벤트입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;아까와는 반대로 클릭한 곳에서 이벤트가 일어났지만, 그 후에 이벤트가 일어난 Dom이 속해있는 상위노드의 이벤트도 모두 일어났음을 확인할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그렇다면, 이벤트 캡쳐링, 버블링 모두 제대로 알지 않으면 원치않는 이벤트를 일으키게 된다는것을 느낄수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이러한 상황을 막기 위해서는 이벤트의 흐름을 차단할 필요가 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이벤트 캡쳐링의 경우에는 useCapture를 false로 지정하면 막을수 있지만, 그렇게 되면 버블링이 작동하게 됩니다. 그렇다면 버블링을 막는 방법을 알면 될것 같습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이벤트 버블링을 막는 방법에는 2가지 방법이 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;하나는 e의 cancelBubble 값을 true로 하는 방법과&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;e의 stopPropagation함수를 호출하는 방법입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;적용해 보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: rgb(249, 38, 114);&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandParent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Parent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;orange&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Me&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;yellow&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Child&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;green&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandChild&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;blue&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;            &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      window.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'load'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(){&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; GrandParent, Parent, Me, Child, GrandChild;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Parent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Me &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Child &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        GrandChild &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;stopPropagation&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Parent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;stopPropagation&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Me.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.cancelBubble &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Child.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;stopPropagation&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandChild.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.cancelBubble &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;      });&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;실행하여 확인하면, 더이상 버블링이 일어나지 않는것을 확인할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* 추가&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(105, 172, 229); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 12pt; letter-spacing: -0.44px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;preventDefault()&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 12pt; letter-spacing: -0.44px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 12pt; letter-spacing: -0.44px;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;이 메소드는 이벤트 전달을 차단함과 동시에 그 dom이 가지고 있는 기본적인 기능또한 차단하는 기능을 가지고 있습니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif; font-size: 12pt; letter-spacing: -0.44px;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px; letter-spacing: -0.44px;&quot;&gt;위의 코드에 a 링크를 추가하고, test.html로 링크를 시켜놓겠습니다.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px; letter-spacing: -0.44px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&amp;lt;!doctype html&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;lang&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;en&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;charset&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;viewport&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;width=device-width, initial-scale=1&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandParent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;red&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Parent&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;orange&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Me&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;yellow&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#Child&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;green&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#GrandChild&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;background-color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;blue&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;      &lt;span style=&quot;color: #a6e22e;&quot;&gt;#test&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;width&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;height&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;px&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;color&lt;/span&gt;: &lt;span style=&quot;color: #66d9ef;&quot;&gt;white&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;style&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;Event Study&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;title&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;head&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;            &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;              &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;a&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Test&quot;&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;href&lt;/span&gt;=&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;test.html&quot;&lt;/span&gt;&amp;gt;테스트링크&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;a&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;            &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;          &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      window.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'load'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(){&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;var&lt;/span&gt; GrandParent, Parent, Me, Child, GrandChild, Test;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandParent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Parent &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Parent&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Me &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Me&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Child &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Child&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        GrandChild &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;GrandChild&quot;&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;        Test &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; document.&lt;span style=&quot;color: #66d9ef;&quot;&gt;getElementById&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Test&quot;&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandParent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;stopPropagation&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Parent.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;stopPropagation&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Me.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.cancelBubble &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        Child.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;stopPropagation&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;br /&gt;&lt;div&gt;        GrandChild.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;          &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div&gt;          e.cancelBubble &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;        });&lt;/div&gt;&lt;div&gt;        &lt;/div&gt;&lt;div&gt;      });&lt;/div&gt;&lt;div&gt;    &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;  &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;body&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;html&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이 코드를 실행시키고 a링크된 텍스트를 클릭하면 당연히 text.html로 페이지는 변하게 됩니다.&lt;/p&gt;&lt;p&gt;하지만 이러한 이벤트를 막고싶을때&amp;nbsp;&lt;span style=&quot;color: rgb(105, 172, 229); font-size: 16px; letter-spacing: -0.44px;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-size: 10pt;&quot;&gt;preventDefault 메서드를 사용하면 됩니다.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(105, 172, 229); font-size: 16px; letter-spacing: -0.44px;&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0); font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;Test.&lt;span style=&quot;color: #66d9ef;&quot;&gt;addEventListener&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;'click'&lt;/span&gt;, &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;function&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;e&lt;/span&gt;){&lt;/div&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;My Name is &quot;&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.id);&lt;/div&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;e.cancelBubble &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;margin-left: 2em;&quot;&gt;e.&lt;span style=&quot;color: #66d9ef;&quot;&gt;preventDefault&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;});&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이렇게 한다면, 버블링도 막고, a링크 원래의 기능도 막을수 있습니다.&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Javascript</category>
      <category>Event</category>
      <category>JavaScript</category>
      <category>javascript event</category>
      <category>이벤트</category>
      <category>자바스크립트</category>
      <category>자바스크립트 이벤트</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/37</guid>
      <comments>https://jaroinside.tistory.com/37#entry37comment</comments>
      <pubDate>Mon, 31 Jul 2017 18:07:00 +0900</pubDate>
    </item>
    <item>
      <title>14.mobx-part1</title>
      <link>https://jaroinside.tistory.com/36</link>
      <description>&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;MobX&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: 24pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:14pt;&quot;&gt;&lt;b&gt;MobX란?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size:14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;em style=&quot;box-sizing: border-box; color: rgb(36, 41, 46); font-family: -apple-system, system-ui, &amp;quot;Segoe UI&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 16px;&quot;&gt;Simple, scalable state management&lt;/em&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;a href=&quot;https://github.com/mobxjs/mobx&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://github.com/mobxjs/mobx&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;mobx는 redux처럼 state를 관리해주지만, redux와는 다른점이 좀 있는&amp;nbsp;라이브러리입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;위에서 명시하여쓴 간단하고, 확장 가능한 상태 관리 도구입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;주요 특징&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;b&gt;&lt;/b&gt;* 데코레이터(Decorator) 를 적극 활용합니다. -&amp;gt; Decorator에 대해서는 mobx 포스팅을 마친뒤 별도로 포스팅 하여 링크하겠습니다.&lt;/span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;* Typescript를 base로 만들어졌기 때문에 typescript에 대한 지원이 좋습니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;* Redux와는 매우 큰 차이로, &lt;b&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;단일 스토어를 강제하지 않습니다!&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;&lt;b&gt;&lt;/b&gt;* 처음 사용이 Redux보다는 쉽습니다.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/26A38233597AC78B2C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F26A38233597AC78B2C&quot; width=&quot;500&quot; height=&quot;277&quot; filename=&quot;스크린샷 2017-07-28 오후 2.11.19.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size:10pt;&quot;&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0);&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;mobx의 전체적인 동작을 나타낸 그림인데요,&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;그림에 대한 설명은 예제를 통해 알아보면서 이해할수 있도록 해보겠습니다.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;이제 CRA를 이용해 프로젝트를 생성하는것은 익숙해지셨을것입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;새로운 프로젝트를 생성해주세요.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;그리고 App.tsx는 containers 폴더로 이동하고 index.tsx 파일 생성과,&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;component 폴더 생성 및 index.tsx 생성까지 해주세요.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/2710DE33597AEF081A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F2710DE33597AEF081A&quot; width=&quot;500&quot; height=&quot;733&quot; filename=&quot;스크린샷 2017-07-28 오후 4.59.48.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;매우 간단한 MobX 예제 따라하기&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;step 1 - state 객체를 정한다. -&amp;gt; 리액트의 state가 아니다.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;step 2 - 정한 state 객체에 @observable 데코레이터를 붙인다.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;step 3 - state 값을 다루는 함수들을 만든다.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;step 4 - state 값이 변경되면 반응하는 컴포넌트를 만든다. -&amp;gt; 이 컴포넌트에 @observer 붙인다&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;step 5 - 컴포넌트에서 state값을 사용한다.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;step 6 - 컴포넌트에서 state값을 변경하는 함수를 사용한다.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Step 1 ~ 2&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;src폴더에 stores 폴더를 생성해주세요. 그리고 index.tsx 파일과 AgeStore.tsx 파일을 생성해주세요.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;src/stores/AgeStore.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div style=&quot;line-height: 18px;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observable } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    @observable &lt;/div&gt;&lt;div&gt;    age&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;우선 기본적으로 클래스를 만들고 그 안에 age 라는 값을 명시합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;여기서 감지할 값에 @observable 을 사용해줘야 하는데, 여기서는 age 값에 해주겠습니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;observable은 mobx 에 있는 기능이므로, mobx를 설치해주세요.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;yarn add mobx&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;혹은&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;npm install --save mobx&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;자 그런데, 이렇게 해도 아마 에디터에서는 오류를 내며 뭐라뭐라 할것입니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;왜냐하면 @ observable은 데코레이터인데, typescript에서 데코레이터를 사용하기 위해서는&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;tsconfig의 설정에서 experimentalDecorators 값을 true로 해주어야 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;하지만 디폴트값이 false로 되있기 때문에 직접 true로 바꿔 줘야 합니다.&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;tsconfig.json&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;compilerOptions&quot;&lt;/span&gt;: {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;outDir&quot;&lt;/span&gt;: &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;build/dist&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;module&quot;&lt;/span&gt;: &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;commonjs&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;target&quot;&lt;/span&gt;: &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;es5&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;lib&quot;&lt;/span&gt;: [&lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;es6&quot;&lt;/span&gt;, &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;dom&quot;&lt;/span&gt;],&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;sourceMap&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;allowJs&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;jsx&quot;&lt;/span&gt;: &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;react&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;moduleResolution&quot;&lt;/span&gt;: &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;node&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;rootDir&quot;&lt;/span&gt;: &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;src&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;forceConsistentCasingInFileNames&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;noImplicitReturns&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;noImplicitThis&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;noImplicitAny&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;strictNullChecks&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;suppressImplicitAnyIndexErrors&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;noUnusedLocals&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;experimentalDecorators&quot;&lt;/span&gt;: &lt;span style=&quot;color: #ae81ff;&quot;&gt;true&lt;/span&gt; &lt;span style=&quot;color: #75715e;&quot;&gt;// 데코레이터를 사용하기 위해 true로 변경&lt;/span&gt;&lt;/div&gt;&lt;div&gt;  },&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;exclude&quot;&lt;/span&gt;: [&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;node_modules&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;build&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;scripts&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;acceptance-tests&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;webpack&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;jest&quot;&lt;/span&gt;,&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;src/setupTests.ts&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;  ],&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;&quot;types&quot;&lt;/span&gt;: [&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #cfcfc2;&quot;&gt;&quot;typePatches&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;  ]&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;src/stores/index.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; AgeStore &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./AgeStore'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; { AgeStore };&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;font-size: 13.3333px;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Step 3&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이제 함수를 생성해 주겠습니다.&lt;/p&gt;&lt;p&gt;기본적으로 state 값을 가져오는 get 함수와 set 함수를 생성하도록 하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div style=&quot;line-height: 18px;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observable } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    @observable &lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;private&lt;/span&gt; _age&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;number&lt;/span&gt;)&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;void&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;        &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;._age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; age;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;font-size: 13.3333px;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Step 4&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Age component를 만들겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;src/components/Age.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{}, {}&amp;gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(230, 219, 116);&quot;&gt;Age&lt;/span&gt;&lt;span style=&quot;color: rgb(230, 219, 116);&quot;&gt;&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: rgb(249, 38, 114);&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;src/components/index.tsx&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; Age &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'./Age'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; { Age };&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b style=&quot;font-size: 13.3333px;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Step 5 ~ 6&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;컴포넌트에서 age값을 사용해보도록 하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;import 해주시고&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;생성해줍니다. ( store라고 생각하시면 됩니다.&amp;nbsp;)&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; ageState &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;);&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: rgb(230, 219, 116);&quot;&gt;Age&lt;/span&gt;&lt;span style=&quot;color: rgb(230, 219, 116);&quot;&gt;&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;한해가 지났다.&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그리고 값이 증가하는 함수와 버튼까지 추가해 보도록 하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; ageState &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{}, {}&amp;gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge.&lt;span style=&quot;color: #a6e22e;&quot;&gt;bind&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;    ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이제 실행해보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/23FC8233597B0A5228&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F23FC8233597B0A5228&quot; width=&quot;500&quot; height=&quot;210&quot; filename=&quot;스크린샷 2017-07-28 오후 6.56.15.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;버튼을 아무리 눌러도 값이 변하는것처럼 보이지는 않습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그런데 제가 위의 코드에 addAge 함수에 console.log를 하나 삽입해 놓은것이 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;개발자 도구로 로그를 살펴보겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/26FF8133597B0C4D3A&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F26FF8133597B0C4D3A&quot; width=&quot;500&quot; height=&quot;207&quot; filename=&quot;스크린샷 2017-07-28 오후 7.04.44.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;값은 증가하는데, 렌더링 적용만 안되었다고 추론할수 있습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이제 @observer 를 적용시켜 보겠습니다.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;observer 는 mobx-react 를 설치해야 사용 가능합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;yarn add mobx-react&lt;/p&gt;&lt;p&gt;혹은&lt;/p&gt;&lt;p&gt;npm install --save mobx-react&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;color: rgb(248, 248, 242); background-color: rgb(39, 40, 34); font-family: Menlo, Monaco, &amp;quot;Courier New&amp;quot;, monospace; font-size: 12px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;as&lt;/span&gt; React &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { AgeStore } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'../stores'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;import&lt;/span&gt; { observer } &lt;span style=&quot;color: #f92672;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: #e6db74;&quot;&gt;'mobx-react'&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; ageState &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;AgeStore&lt;/span&gt;(&lt;span style=&quot;color: #ae81ff;&quot;&gt;30&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;@observer&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;Age&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;extends&lt;/span&gt; &lt;span style=&quot;color: rgb(166, 226, 46); text-decoration-line: underline;&quot;&gt;React&lt;/span&gt;.&lt;span style=&quot;color: rgb(166, 226, 46); font-style: italic; text-decoration-line: underline;&quot;&gt;Component&lt;/span&gt;&amp;lt;{}, {}&amp;gt; {&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;constructor&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;font-style: italic;&quot;&gt;props&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;:&lt;/span&gt; {}) {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;super&lt;/span&gt;(props);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.addAge.&lt;span style=&quot;color: #a6e22e;&quot;&gt;bind&lt;/span&gt;(&lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;render&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #f92672;&quot;&gt;return&lt;/span&gt; (&lt;/div&gt;&lt;div&gt;      &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;className&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #e6db74;&quot;&gt;&quot;Age&quot;&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;{ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;()}&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;h1&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;        &amp;lt;&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #a6e22e;&quot;&gt;onClick&lt;/span&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt;{() &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #fd971f;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;()}&amp;gt;나이증가&amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;      &amp;lt;/&lt;span style=&quot;color: #f92672;&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div&gt;    );&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  &lt;span style=&quot;color: #a6e22e;&quot;&gt;addAge&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;const&lt;/span&gt; age &lt;span style=&quot;color: #f92672;&quot;&gt;=&lt;/span&gt; ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;    ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;setAge&lt;/span&gt;(age &lt;span style=&quot;color: #f92672;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #ae81ff;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;    &lt;span style=&quot;color: #66d9ef;font-style: italic;&quot;&gt;console&lt;/span&gt;.&lt;span style=&quot;color: #66d9ef;&quot;&gt;log&lt;/span&gt;(ageState.&lt;span style=&quot;color: #a6e22e;&quot;&gt;getAge&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #f92672;&quot;&gt;export&lt;/span&gt; &lt;span style=&quot;color: #f92672;&quot;&gt;default&lt;/span&gt; Age;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;간단하게 observer를 import하고, 사용할 컴포넌트 위에 @observer 를 명시해줍니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;실행해주세요.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: center; clear: none; float: none;&quot;&gt;&lt;span class=&quot;imageblock&quot; style=&quot;display: inline-block; width: 500px;  height: auto; max-width: 100%;&quot;&gt;&lt;img src=&quot;https://t1.daumcdn.net/cfile/tistory/22AE9033597B0D3F1C&quot; srcset=&quot;https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&amp;fname=https%3A%2F%2Ft1.daumcdn.net%2Fcfile%2Ftistory%2F22AE9033597B0D3F1C&quot; width=&quot;500&quot; height=&quot;223&quot; filename=&quot;스크린샷 2017-07-28 오후 7.08.46.png&quot; filemime=&quot;image/jpeg&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이제 정상적으로 렌더링이 됩니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;즉, 변화를 감지하고 싶은 대상에는 observable 데코레이터 를 사용하고,&lt;/p&gt;&lt;p&gt;observable된 값 변화에 따라 반응하는 컴포넌트에는 observer 데코레이터를 사용하여&lt;/p&gt;&lt;p&gt;제어하는 간단한 구조입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;뭔가 redux보다는 확실히 중간 과정이 편한 느낌입니다.&lt;/p&gt;&lt;p&gt;redux는 액션타입을 지정하고, 액션 크리에이터 함수를 만들고, 리덕스를 만들고, 스토어 생성한다음,..... 많은 과정이 필요하지만, mobx는 그 과정이 정말 최소화된 느낌입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;물론 각각의 장단점이 있으리라 생각되지만, 더 공부를 해야 확실하게 생각을 말할수 있을거 같습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;이번 포스팅은 간단하게 끝내고, 다음 포스팅도 계속해서 mobx에 대해 포스팅을 하도록 하겠습니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;감사합니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;소스코드 주소입니다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/JaroInside/tistory-react-typescript-study/tree/14.mobx-part1&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;https://github.com/JaroInside/tistory-react-typescript-study/tree/14.mobx-part1&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr class=&quot;tx-hr-border-2&quot; style=&quot;display:block; border: black 0 none; border-top: black 1px solid; border-bottom: black 3px solid; height: 7px&quot;&gt;&lt;p&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;참고 슬라이드 -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;http://slides.com/woongjae/react-with-typescript-&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;4&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-3#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background-color: transparent; color: rgb(48, 48, 48); transition: color 0.2s ease-in-out;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://slides.com/woongjae/react-with-typescript-4#/&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot;&gt;#/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14pt;&quot;&gt;참고 동영상 -&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.youtube.com/playlist?list=PLV6pYUAZ-ZoHx0OjUduzaFSZ4_cUqXLm0&quot; target=&quot;_blank&quot; class=&quot;tx-link&quot; style=&quot;box-sizing: border-box; background: rgb(241, 241, 241); color: ivory; transition: all 0.3s; font-size: 14px; padding: 1px; font-family: &amp;quot;Ubuntu Condensed&amp;quot;, &amp;quot;Noto Sans Korean&amp;quot;;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-size: 14pt; font-family: &amp;quot;맑은 고딕&amp;quot;, sans-serif;&quot;&gt;https://www.youtube.com/playlist?list=PLV6pYUAZ-ZoHx0OjUduzaFSZ4_cUqXLm0&lt;/span&gt;&lt;/a&gt;&lt;br style=&quot;box-sizing: border-box; color: rgb(51, 51, 51); font-family: &amp;quot;KoPub Dotum&amp;quot;; font-size: 14px;&quot;&gt;&lt;/p&gt;</description>
      <category>React/React&amp;amp;typeScript</category>
      <category>mobx</category>
      <category>React</category>
      <category>TypeScript</category>
      <category>리액트</category>
      <category>몹엑스</category>
      <category>타입스크립트</category>
      <author>Jaro</author>
      <guid isPermaLink="true">https://jaroinside.tistory.com/36</guid>
      <comments>https://jaroinside.tistory.com/36#entry36comment</comments>
      <pubDate>Fri, 28 Jul 2017 19:19:20 +0900</pubDate>
    </item>
  </channel>
</rss>