blob: 31282744be2552c62886adf74c798fa2a8e712e3 (
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() {
return schemaCtor(this.props.Document);
}
}
return Component;
}
|