fix children
parent
74601f602e
commit
5588f04b7e
|
|
@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue