blob: d6562492fe4a4d5c7aba8e94cebc7d256969b07a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import * as React from 'react';
import { Doc } from '../../new_fields/Doc';
import { computed } from 'mobx';
export function DocComponent<P extends { Document: Doc }, T>(schemaCtor: (doc: Doc) => T) {
class Component extends React.Component<P> {
//TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
@computed
get Document(): T {
return schemaCtor(this.props.Document);
}
}
return Component;
}
|