Closed
Description
Is it possible to change element's parent so element will be just "moved" from current parent to new?
@StoreConnect("params")
class ParentRenderer extends React.Component<any, any> {
public render(): any {
const { children, params: { parent } } = this.props;
if (parent)
return React.createElement(parent, undefined, children);
}
return children;
}
}
Using this code, when ParentRenderer's children is changed the parent is not re-rendered. This is perfect. But if we change parent (actually it is being changed by new children, because each children's componentWillMount is updating store and sets required parent) will happen:
- old children unmounting, new children mounting
- old parent unmounting, current children unmounting
- new parent mounting, current children mounting
The simplest way to solve this (and the only I see) — change children and parent in the same time. But I would like to know is there any other options, because changing children and parent in the same time is breaking my app, and also there is lack of information in the internet about this or similar cases (or my googling skills are broken).
Metadata
Metadata
Assignees
Labels
No labels