<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>two-vs-han.log</title>
        <link>https://velog.io/</link>
        <description>Planby 개발자</description>
        <lastBuildDate>Thu, 07 Apr 2022 07:53:45 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>two-vs-han.log</title>
            <url>https://images.velog.io/images/two-vs-han/profile/88cbe719-9bac-4dbc-ad2a-4d1dfde148af/social.png</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. two-vs-han.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/two-vs-han" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[220404 TIL]]></title>
            <link>https://velog.io/@two-vs-han/220404-TIL</link>
            <guid>https://velog.io/@two-vs-han/220404-TIL</guid>
            <pubDate>Thu, 07 Apr 2022 07:53:45 GMT</pubDate>
            <description><![CDATA[<h2 id="jest">Jest</h2>
<p>Open source developped by Facebook to test React files.</p>
<h3 id="main-functions">Main functions</h3>
<pre><code class="language-jsx">describe(&quot;name of test group&quot;, () =&gt; {
    test(&quot;name of test&quot;, () =&gt; {
      expect(37).toBeEqual(37);
    }) // test function can be named &quot;it&quot;
})</code></pre>
<p>There are many methods that can be used to test JS code.</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[220329 TIL]]></title>
            <link>https://velog.io/@two-vs-han/220329-TIL</link>
            <guid>https://velog.io/@two-vs-han/220329-TIL</guid>
            <pubDate>Wed, 30 Mar 2022 11:09:48 GMT</pubDate>
            <description><![CDATA[<blockquote>
</blockquote>
<h2 id="redux-saga">Redux-saga</h2>
<p>A redux middleware that deals with every side effect.</p>
<h3 id="basic-principle">Basic Principle</h3>
<ol>
<li>create a <code>SomethingSaga.ts</code> saga file that collects side effects of some variable.</li>
<li>connect that saga file to <code>rootSaga.ts</code> file.</li>
<li>dispatch the action that runs the saga file.</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[220328 TIL]]></title>
            <link>https://velog.io/@two-vs-han/220328-TIL</link>
            <guid>https://velog.io/@two-vs-han/220328-TIL</guid>
            <pubDate>Mon, 28 Mar 2022 14:53:16 GMT</pubDate>
            <description><![CDATA[<h2 id="how-to-communicate-without-using-downward-only-props">How to communicate without using downward-only props</h2>
<h3 id="context-api">Context API</h3>
<p>How to use it? First, create a context using <code>React.createContext()</code>.
Then this context on the top component allows all the other child components to use the same variable or state.
In <code>App.js</code>, make a <code>&lt;SomeContext.Provider&gt;</code> component and set the <code>value</code> prop as the variable or state you want to manage in other components.</p>
<h3 id="how-to-get-the-context-data-from-child-components">How to get the context data from child components</h3>
<p>Use <code>useContext()</code> hook to get the data from Context API.</p>
<pre><code class="language-jsx">import { useContext } from &quot;react&quot;;
import PersonContext from &quot;../contexts/PersonContext&quot;; //The context file that contains React.createContext()

export default function ContextExample() {
  const persons = useContext(PersonContext);

  return (
    &lt;ul&gt;
      {persons.map((person) =&gt; {
        &lt;li&gt;{person.name}&lt;/li&gt;;
      })}
    &lt;/ul&gt;
  );
}</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[220325 TIL]]></title>
            <link>https://velog.io/@two-vs-han/220325-TIL</link>
            <guid>https://velog.io/@two-vs-han/220325-TIL</guid>
            <pubDate>Fri, 25 Mar 2022 12:46:07 GMT</pubDate>
            <description><![CDATA[<h2 id="how-to-deal-with-history-in-react-router-dom-v6">How to deal with history in React-router-dom v6</h2>
<p>Instead of <code>useHistory()</code> function or history props contained in <code>&lt;Route /&gt;</code> component in v5, we use <code>useNavigate()</code> function to move page inside an event.</p>
<pre><code class="language-jsx">import { useNavigate } from &quot;react-router&quot;;

export default function Login() {
  const navigate = useNavigate();
  function login() {
    setTimeout(() =&gt; {
      navigate(&quot;/&quot;);
    }, 1000);
  }

  return (
    &lt;div&gt;
      &lt;h2&gt;Login 페이지입니다.&lt;/h2&gt;
      &lt;button onClick={login}&gt;로그인하기&lt;/button&gt;
    &lt;/div&gt;
  );
}</code></pre>
<h3 id="ant-design">Ant Design</h3>
<p>install by <code>npm i antd</code></p>
<p>From ant design package, we can use lots of components or icons which are styled already.</p>
<h3 id="hooks">hooks</h3>
<p><code>useMemo()</code> , <code>useRef()</code> , <code>useCallback()</code> hooks are used to keep the state without change in functional components. Since state components have <code>render()</code> function, they does not have to manage unchanging states. However, functional components do not have such function that deals with rendering itself, so these three hooks exist to limit the change of states.</p>
<h3 id="change-parent-components-from-child">Change parent components from child</h3>
<ol>
<li><code>&lt;A /&gt;</code> 에 함수를 만들고, 그 함수 안에 state를 변경하도록 구현, 그 변경으로 인해 렌더링 되는 어떤 내용을 변경.</li>
<li>만들어진 함수를 props에 담아서, <code>&lt;B /&gt;</code>로 전달</li>
<li><code>&lt;B /&gt;</code>의 props의 함수를 <code>&lt;C /&gt;</code>의 props로 전달</li>
<li><code>&lt;C /&gt;</code>의 props의 함수를 <code>&lt;D /&gt;</code>의 props로 전달</li>
<li><code>&lt;D /&gt;</code>의 props의 함수를 <code>&lt;E /&gt;</code>의 props로 전달, <code>&lt;E /&gt;</code>에서 클릭하면 props로 받은 함수를 실행</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[220321 TIL]]></title>
            <link>https://velog.io/@two-vs-han/220321-TIL</link>
            <guid>https://velog.io/@two-vs-han/220321-TIL</guid>
            <pubDate>Mon, 21 Mar 2022 14:08:18 GMT</pubDate>
            <description><![CDATA[<h2 id="react">React</h2>
<p>JSX elements are compiled into pure javascript using <code>Babel</code>.</p>
<h3 id="react-router-dom">react-router-dom</h3>
<p>Install by <code>npm i react-router-dom</code>
This package makes it easier for a react project to be a SPA.</p>
<blockquote>
<p>Using react-router-dom v6
Unlike previous versions, from v6 one should code a routes-system like</p>
</blockquote>
<pre><code class="language-jsx">&lt;BrowserRouter&gt;
      &lt;Routes&gt; {/*This tag is needed */}
        &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt; {/* &#39;component&#39; props is replaced with &#39;element&#39; */}
        &lt;Route path=&quot;/profile&quot; element={&lt;Profile /&gt;} /&gt;
        &lt;Route path=&quot;/about&quot; element={&lt;About /&gt;} /&gt;
      &lt;/Routes&gt;
    &lt;/BrowserRouter&gt;</code></pre>
<p>&#39;exact&#39; props is not needed anymore.</p>
<h4 id="reading-url-props">Reading URL props</h4>
<p>If someone wants a &#39;dynamic routing&#39; using id(e.g. profileId), one can nest another route in original route.</p>
<pre><code class="language-jsx">&lt;Route path=&quot;/profile&quot; element={&lt;Profile /&gt;} &gt;
  &lt;Route path=&quot;:profileId&quot; element={&lt;Profile /&gt;} /&gt;
&lt;/Route&gt;</code></pre>
<p>Then in the <code>Profile</code> component, use <code>useParams()</code> function.</p>
<pre><code class="language-jsx">import { useParams } from &quot;react-router-dom&quot;;

export default function Profile() {
  const params = useParams();
  const id = params.profileId;
  console.log(id);
  return (
    &lt;div&gt;
      &lt;h2&gt;Profile 페이지입니다.&lt;/h2&gt;
      {id &amp;&amp; &lt;p&gt;id는 {id}입니다.&lt;/p&gt;}
    &lt;/div&gt;
  );
}</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[220220 Daily development]]></title>
            <link>https://velog.io/@two-vs-han/220220-Daily-development</link>
            <guid>https://velog.io/@two-vs-han/220220-Daily-development</guid>
            <pubDate>Sun, 20 Feb 2022 14:45:58 GMT</pubDate>
            <description><![CDATA[<h2 id="what-i-learned-today">What I learned today</h2>
<p>If someone code a function-based component in react native, the component calls the props(no matter the param&#39;s name) as the first parameter.</p>
<h3 id="react-native-hooks">React native hooks</h3>
<ul>
<li><code>useState(initValue)</code>: Returns an array, whose first entry is the name of a state, and the second one is the name of a function which will be used to change the state.</li>
<li><code>useEffect(callbackFunction, [array]){}</code> : A hook that works the same as <code>componentDidMount</code> and <code>componentDidUpdate</code> in class-based components. One component may contain multiple <code>useEffect</code> hooks, and they will operate in an order. By writing the name of state in the <code>[array]</code> part, one can easily control the states at which the useEffect hook is going to react. If nothing is written like <code>[]</code>, the hook works as same as <code>componentDidMount</code>.<ul>
<li><code>return(callback function)</code> in a <code>useEffect</code> hook works the same as <code>componentWillUnmount</code> in class-based components. It works as a clean-up phase of an update of a component.</li>
</ul>
</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[220211 개발일지]]></title>
            <link>https://velog.io/@two-vs-han/220211</link>
            <guid>https://velog.io/@two-vs-han/220211</guid>
            <pubDate>Fri, 11 Feb 2022 16:20:53 GMT</pubDate>
            <description><![CDATA[<h2 id="오늘의-문제점">오늘의 문제점</h2>
<p>expo로 실행된 앱의 개발 메뉴에서 &#39;remote JS debug&#39;라는 메뉴는 클릭하지 말자. 앱이 로딩되지 않는다.</p>
<p>만약 눌렀다면</p>
<blockquote>
<p>import { NativeModules } from &#39;react-native&#39;;
NativeModules.DevSettings.setIsDebuggingRemotely(false);</p>
</blockquote>
<p>위의 코드를 맨 위에 작성함으로써 코드 단에서 강제로 토글시킬 수 있다.</p>
<p>근데 이러면 무한 다운로딩 이슈가 생긴다. 뭐가 문제인지는 잘 모르겠으나 번들러가 맛이 가서 계속 앱을 다시 다운로드하는 일이 발생한다. 다시 지우면 문제가 해결되기는 하나, 번들러가 맛이 가있는 상태여서 내가 코드에 작성한 변화가 저장을 하거나 앱을 다시 리로드하더라도 앱에 반영되지 않게 된다. 어디에 검색해도 답을 찾기가 어려웠는데, 결국 스스로 해결해냈다.</p>
<h3 id="해결책">해결책</h3>
<p><code>.expo/settings.json</code>에서 <code>&quot;urlRandomness&quot;: &quot;아무말이나&quot;</code> 로 설정을 바꿔주면 번들러가 다시 정신을 차리고 파일의 변화를 바로바로 앱에 반영한다.</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[220209 개발일지]]></title>
            <link>https://velog.io/@two-vs-han/220209-%EA%B0%9C%EB%B0%9C%EC%9D%BC%EC%A7%80</link>
            <guid>https://velog.io/@two-vs-han/220209-%EA%B0%9C%EB%B0%9C%EC%9D%BC%EC%A7%80</guid>
            <pubDate>Wed, 09 Feb 2022 09:47:43 GMT</pubDate>
            <description><![CDATA[<h2 id="오늘-알게-된-것">오늘 알게 된 것</h2>
<p>V50ThinQ 모델에서 expo 앱을 usb를 통해 실행시키려면 PTP(사진 및 영상 전송) 모드로 연결해야 한다. 그럼 디버깅 허용 안내문이 뜨면서 실행이 잘 된다.</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[220208 개발일지]]></title>
            <link>https://velog.io/@two-vs-han/220208-%EA%B0%9C%EB%B0%9C%EC%9D%BC%EC%A7%80</link>
            <guid>https://velog.io/@two-vs-han/220208-%EA%B0%9C%EB%B0%9C%EC%9D%BC%EC%A7%80</guid>
            <pubDate>Mon, 07 Feb 2022 18:29:28 GMT</pubDate>
            <description><![CDATA[<h2 id="git-명령어">Git 명령어</h2>
<blockquote>
<pre><code>$git clone url링크 DIR</code></pre></blockquote>
<pre><code>Github에서 url링크로 복사해옴</code></pre><p>$git pull origin main --allow-unrelated-histories</p>
<pre><code>Unrelated histories 관계 없이 어떤 branch에 있는 것 다 pull함</code></pre><p>$git remote add origin url링크</p>
<pre><code>url링크와 local repository를 연동시킴</code></pre><p>$git push origin main</p>
<p>```
main branch에 현재  commit을 추가함</p>
<h2 id="react-native-map-libraries">React Native Map Libraries</h2>
<blockquote>
<p>여기를 참고해보자
<a href="https://openbase.com/categories/js/best-react-native-map-libraries">https://openbase.com/categories/js/best-react-native-map-libraries</a></p>
</blockquote>
<h2 id="오늘의-한-일">오늘의 한 일</h2>
<p>우선 카카오 로컬 api를 이용하여 검색된 장소의 좌표를 얻어온 뒤 해당 좌표에 마커를 찍는 것에 성공함. 마커를 클릭하면 제목과 설명도 나옴.
장소 검색 기능도 만들어 봄. 입력하면 거기로 감. 굿.
<img src="https://images.velog.io/images/two-vs-han/post/f7f6af11-18d3-4e40-9139-f4bd41ba6cb0/image.png" alt=""></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[220127 개발일지]]></title>
            <link>https://velog.io/@two-vs-han/220127-%EA%B5%AC%EA%B8%80-%EB%A7%B5-API</link>
            <guid>https://velog.io/@two-vs-han/220127-%EA%B5%AC%EA%B8%80-%EB%A7%B5-API</guid>
            <pubDate>Wed, 26 Jan 2022 16:19:07 GMT</pubDate>
            <description><![CDATA[<blockquote>
<p><a href="https://mildb.tistory.com/68">https://mildb.tistory.com/68</a>
구글 맵 Expo로 쓰는 방법</p>
</blockquote>
<blockquote>
<p>provider={MapView.PROVIDER_GOOGLE}
아이폰에서 구글맵 띄우는 방법: MapView 태그 안에 들어가는 props</p>
</blockquote>
<blockquote>
<p><a href="https://yannichoongs.tistory.com/175?category=802704">https://yannichoongs.tistory.com/175?category=802704</a>
react-native-nmap 이용한 개발 일지</p>
</blockquote>
<h2 id="오늘의-목표">오늘의 목표</h2>
<p>react-native-nmap을 이용해서 앱에 지도 띄우기</p>
<h2 id="오늘의-삽질">오늘의 삽질</h2>
<p>처음에 react native 프로젝트를 만들어서 진행을 하다가 이것저것 깔고 하다보니 문제가 많아서,
그냥 github에 올라와 있는 example을 그대로 복사해서 해봤다.</p>
<h2 id="하는-방법">하는 방법</h2>
<blockquote>
<ol>
<li>github(<a href="https://github.com/QuadFlask/react-native-naver-map.git)%EC%97%90%EC%84%9C">https://github.com/QuadFlask/react-native-naver-map.git)에서</a> 클론해온다.</li>
<li>example 폴더에서 npm install (dependencies 모두 설치)</li>
<li>android &gt; app &gt; src &gt; main &gt; AndroidManifest.xml 에 naver api key 추가</li>
<li>ios &gt; example &gt; info.plist 에도 key 추가</li>
<li>npx react-native run-android 하면 끝</li>
</ol>
</blockquote>
<p>이렇게 하니 android emulator에서 띄우는 것에는 성공했다.
그렇지만 실제 기기에서도 테스트 해보고 싶어서
<a href="https://marshmello.tistory.com/78?category=1213283">https://marshmello.tistory.com/78?category=1213283</a>
여기서 방법을 알아내서 가지고 있는 LG의 V50S ThinQ 모델에 띄워보는 것에 성공했다.</p>
<p>네이버 맵이 굉장히 구동이 잘 된다는 것을 확인했다. 띠용?</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[스파르타코딩 앱개발 종합반 6-8주차 앱 기획안]]></title>
            <link>https://velog.io/@two-vs-han/%EC%8A%A4%ED%8C%8C%EB%A5%B4%ED%83%80%EC%BD%94%EB%94%A9-%EC%95%B1%EA%B0%9C%EB%B0%9C-%EC%A2%85%ED%95%A9%EB%B0%98-6-8%EC%A3%BC%EC%B0%A8-%EC%95%B1-%EA%B8%B0%ED%9A%8D%EC%95%88</link>
            <guid>https://velog.io/@two-vs-han/%EC%8A%A4%ED%8C%8C%EB%A5%B4%ED%83%80%EC%BD%94%EB%94%A9-%EC%95%B1%EA%B0%9C%EB%B0%9C-%EC%A2%85%ED%95%A9%EB%B0%98-6-8%EC%A3%BC%EC%B0%A8-%EC%95%B1-%EA%B8%B0%ED%9A%8D%EC%95%88</guid>
            <pubDate>Fri, 26 Nov 2021 10:19:28 GMT</pubDate>
            <description><![CDATA[<p><img src="https://images.velog.io/images/two-vs-han/post/991c58fa-3e1e-4e7b-a335-407ad5bbe6d1/%EC%8A%A4%ED%8C%8C%EB%A5%B4%ED%83%80%20%EC%95%B1%20%EA%B0%9C%EB%B0%9C%20%EA%B8%B0%ED%9A%8D%EC%84%9C.jpg" alt=""></p>
]]></description>
        </item>
    </channel>
</rss>