【React】reactのcomponentWillMount

1 2 3 4 5 6 7 8 9 10 11 |
<span class="nx">componentWillMount</span><span class="p">(){</span> <span class="kd">const</span> <span class="nx">request</span> <span class="o">=</span> <span class="nx">axios</span><span class="p">.</span><span class="nx">create</span><span class="p">({</span> <span class="na">baseURL</span><span class="p">:</span> <span class="dl">'</span><span class="s1">http://localhost:8080</span><span class="dl">'</span> <span class="p">})</span> <span class="nx">request</span><span class="p">.</span><span class="kd">get</span><span class="p">(</span><span class="dl">'</span><span class="s1">/describe</span><span class="dl">'</span><span class="p">)</span> <span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="nx">res</span> <span class="o">=></span> <span class="p">{</span> <span class="k">this</span><span class="p">.</span><span class="nx">setState</span><span class="p">({</span> <span class="na">userDatas</span><span class="p">:</span> <span class="nx">res</span><span class="p">.</span><span class="nx">data</span> <span class="p">});</span> <span class="p">})</span> <span class="p">}</span> |