Skip to content

Commit

Permalink
Use class-instance render-prop pattern in Accordion.wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ryami333 committed Jul 24, 2018
1 parent 9c1b37a commit 7d43bd2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/Accordion/Accordion.wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ class AccordionWrapper extends Component<AccordionWrapperProps> {
this.accordionStore.setOnChange(this.props.onChange);
}

render() {
renderAccordion = (accordionStore: AccordionContainer) => {
const { accordion, onChange, ...rest } = this.props;
return (
<Accordion accordion={accordionStore.state.accordion} {...rest} />
);
};

render() {
return (
<Provider inject={[this.accordionStore]}>
<Subscribe to={[AccordionContainer]}>
{accordionStore => (
<Accordion
accordion={accordionStore.state.accordion}
{...rest}
/>
)}
{this.renderAccordion}
</Subscribe>
</Provider>
);
Expand Down

0 comments on commit 7d43bd2

Please sign in to comment.