on master help sign in
Use useLifecycle over useEffect
commite15c5fd5fb4a8e73bd1c863f67c969c098eda95d authorFang <git@fang.io> dateTue 25 Jun 2019, 17:20 (7 years ago) parent1a7e04e
1 file changed+5−7
src/views/Login.js+5−7
src/views/Login.js+5−7
@@ -1,5 +1,5 @@
11import { Nothing, Just } from 'folktale/maybe';
2−import React, { useState, useEffect } from 'react';
2+import React, { useState } from 'react';
33import * as azimuth from 'azimuth-js';
44
55import { H1 } from 'indigo-react';
@@ -10,6 +10,7 @@ import Ticket from './Login/Ticket';
1010import Mnemonic from './Login/Mnemonic';
1111import Advanced from './Login/Advanced';
1212
13+import useLifecycle from 'lib/useLifecycle';
1314import * as need from 'lib/need';
1415import { ROUTE_NAMES } from 'lib/routeNames';
1516
@@ -46,14 +47,11 @@ export default function Login() {
4647 // inputs
4748 const [currentTab, setCurrentTab] = useState(TABS.TICKET);
4849
49− useEffect(() => {
50− // on-mount
50+ // on-mount
51+ useLifecycle(() => {
5152 setUrbitWallet(Nothing());
5253 setPointCursor(Nothing());
53−
54− // on-unmount
55− return () => {};
56− }, []);
54+ });
5755
5856 const doContinue = async () => {
5957 const _wallet = need.wallet(wallet);