Skip to content

Commit 775dcbd

Browse files
committed
Cache generated dynamicTagName
1 parent 8cf691f commit 775dcbd

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/styled.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ const styled = ({tagName, elementStyle, mountSheets}: StyledArgs) => {
3434

3535
constructor(props: StyledElementPropsType) {
3636
super(props)
37-
this.dynamicTagName = generateTagName(tagName)
37+
if (!this.dynamicTagName) {
38+
this.dynamicTagName = generateTagName(tagName)
39+
}
3840
}
3941

4042
componentWillMount() {
@@ -61,10 +63,6 @@ const styled = ({tagName, elementStyle, mountSheets}: StyledArgs) => {
6163
}
6264
}
6365

64-
componentWillUnmount() {
65-
this.dynamicSheet.deleteRule(this.dynamicTagName)
66-
}
67-
6866
render() {
6967
if (!this.staticSheet) return null
7068

0 commit comments

Comments
 (0)