Open chenjun1011 opened 2 years ago
This feat makes component's defaultProps
invalid, reproduce code:
import { createElement, useEffect, useState, useRef, PureComponent, lazy, Suspense } from 'rax';
import Text from 'rax-text';
class TextView extends PureComponent {
static defaultProps = {
text: 'default text'
};
render() {
return <div>
<Text>{this.props.text || 'no default value'}</Text>
</div>
}
}
const LazyTextView = lazy(() => {
return new Promise(resolve => {
setTimeout(() => resolve({ default: TextView }), 2000);
})
});
function Loading() {
return <Text>loading...</Text>
}
export default function Defer() {
return <div>
<Suspense fallback={<Loading />}>
<TextView />
<LazyTextView />
</Suspense>
</div>
}
output: default text no default value