Skip to content

Commit

Permalink
issue-333 simplify reactive unmoderated data warning
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikGuzei committed Sep 21, 2020
1 parent 0c7d34b commit 7163f50
Showing 1 changed file with 8 additions and 14 deletions.
@@ -1,21 +1,15 @@
import React, { useState } from 'react';
import { useObservableEffect } from '../../../../lib/mobx/react';
import { Observer } from 'mobx-react-lite';
import React from 'react';
import { useStakePools } from '../../context';
import UnmoderatedDataConsented from './UnmoderatedDataConsented';

export const UnmoderatedDataConsentedContainer = () => {
const { store } = useStakePools();
const [showUnmoderatedData, setShowUnmoderatedData] = useState(
store.showUnmoderatedData
return (
<Observer>
{() =>
store.showUnmoderatedData ? <UnmoderatedDataConsented /> : <span />
}
</Observer>
);

// Observe and update consent flag
useObservableEffect(() => {
setShowUnmoderatedData(store.showUnmoderatedData);
});

if (showUnmoderatedData) {
return <UnmoderatedDataConsented />;
}
return null;
};

0 comments on commit 7163f50

Please sign in to comment.