fix children

stable
Valerie 2021-08-23 14:11:04 -04:00
parent 74601f602e
commit 5588f04b7e
2 changed files with 9 additions and 6 deletions

View File

@ -21,16 +21,19 @@ const Form = ({
}, []); }, []);
const modifiedChildren = useMemo(() => { const modifiedChildren = useMemo(() => {
return children.map(child => { return React.Children.map(children, child => {
return React.cloneElement( return React.cloneElement(
child child,
{
updateData: handleData
}
) )
}) });
}, [children]) }, [children]);
return ( return (
<Box flexDirection="column"> <Box flexDirection="column">
{modifiedChildren}
</Box> </Box>
); );
} }

View File

@ -46,7 +46,7 @@ const App = () => {
}, []); }, []);
useEffect(() => { useEffect(() => {
mongoose.connect('mongodb://localhost', { mongoose.connect('mongodb+srv://todo:todo@cluster0.phn2o.mongodb.net/myFirstDatabase?retryWrites=true&w=majority', {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true useUnifiedTopology: true
}).then(() => new Promise(res => setTimeout(res, 1000))).then(() => { }).then(() => new Promise(res => setTimeout(res, 1000))).then(() => {