如何通过其他功能在func中编辑段落?
const func = ({ onChange, onDeselect }) => (
<div>
<p>Edit this</p>
</div>
);
答案 0 :(得分:0)
添加另一个道具:
const func = ({ onChange, onDeselect, copy }) => (
<div>
<p>{copy}</p>
</div>
);
答案 1 :(得分:0)
我希望contentProp成为内容,但是我正在导出此组件,因此渲染位于另一个文件中。
let content = <SearchContent />;
function renderTabContent({ getTabContentProps, value }) {
const SampleTab = SampleTabs[value];
content = <SampleTab {...getTabContentProps()} />;
}
renderTabContent.propTypes = {
getTabContentProps: PropTypes.func,
value: PropTypes.string
};
const TabsApp = ({ onChange, onDeselect, contentProp }) => (
<div>
<AppHeader
data-testod="hearder"
position="static"
renderNav={({ getNavProps }) => (
<div {...getNavProps({})} >
<Tabs
centered
noBorder
defaultValue={Search}
displayName={'centeredExample'}
onChange={onChange}
onDeselect={onDeselect}
render={({ getTabProps }) => <Tab {...getTabProps()} />}
renderTabContent={renderTabContent}
tabs={[Search, Add, Update]}
/>
</div>
)}
/>
<div>{contentProp}</div>
</div>
);
TabsApp.propTypes = {
onChange: PropTypes.func,
onDeselect: PropTypes.func,
contentProp: PropTypes.element
};