on master help sign in
Use useLifecycle over useEffect
e15c5fdFang
src/views/Login.js+5−7
@@ -1,5 +1,5 @@
1import { Nothing, Just } from 'folktale/maybe';
1import { Nothing, Just } from 'folktale/maybe';
2−import React, { useState, useEffect } from 'react';
2+import React, { useState } from 'react';
3import * as azimuth from 'azimuth-js';
3import * as azimuth from 'azimuth-js';
4
4
5import { H1 } from 'indigo-react';
5import { H1 } from 'indigo-react';
@@ -10,6 +10,7 @@ import Ticket from './Login/Ticket';
10import Mnemonic from './Login/Mnemonic';
10import Mnemonic from './Login/Mnemonic';
11import Advanced from './Login/Advanced';
11import Advanced from './Login/Advanced';
12
12
13+import useLifecycle from 'lib/useLifecycle';
13import * as need from 'lib/need';
14import * as need from 'lib/need';
14import { ROUTE_NAMES } from 'lib/routeNames';
15import { ROUTE_NAMES } from 'lib/routeNames';
15
16
@@ -46,14 +47,11 @@ export default function Login() {
46 // inputs
47 // inputs
47 const [currentTab, setCurrentTab] = useState(TABS.TICKET);
48 const [currentTab, setCurrentTab] = useState(TABS.TICKET);
48
49
49− useEffect(() => {
50− // on-mount
50+ // on-mount
51+ useLifecycle(() => {
51 setUrbitWallet(Nothing());
52 setUrbitWallet(Nothing());
52 setPointCursor(Nothing());
53 setPointCursor(Nothing());
53−
54− // on-unmount
55− return () => {};
56− }, []);
54+ });
57
55
58 const doContinue = async () => {
56 const doContinue = async () => {
59 const _wallet = need.wallet(wallet);
57 const _wallet = need.wallet(wallet);