Open Topppy opened 4 years ago
If you pass an empty array ([]), the props and state as inside the effect will always have their initial values.
useEffect( () => { const subscription = props.source.subscribe(); console.log(this.state.a) return () => { subscription.unsubscribe(); }; }, [], );
a will never change.
If you pass an empty array ([]), the props and state as inside the effect will always have their initial values.
a will never change.