我在Firebase官方指南中找不到此用例的解决方案.
我的代码如下.提前致谢.
功能:
exports.myFunction = functions.https.onCall((data, context) => {
const id = context.auth.uid;
const message = data.message;
admin.firestore()...
// Do something with Firestore //
});
Run Code Online (Sandbox Code Playgroud)
客户来电:
const message = { message: 'Hello.' };
firebase.functions().httpsCallable('myFunction')(message)
.then(result => {
// Do something //
})
.catch(error => {
// Error handler //
});
Run Code Online (Sandbox Code Playgroud) 我的HOC:
const withPaper = Component => props => (
<Paper>
<Component {...props} />
</Paper>
);
export default withPaper;
Run Code Online (Sandbox Code Playgroud)
我想使用以下样式设置“ Paper”组件withStyles():
const styles = theme => ({
root: {
backgroundColor: 'green'
}
});
const withPaper = ?? => ?? => (
<Paper className={classes.root}>
<Component {...props} />
</Paper>
);
export default withStyles(styles)(withPaper);
Run Code Online (Sandbox Code Playgroud)
我如何注入类来支持这种情况?我的简单想法Component => ({classes, ...props}) =>记录了错误。
TypeError:无法将类作为函数调用