Skip to content

Commit

Permalink
Merge pull request #3941 from himdel/registry-component-class
Browse files Browse the repository at this point in the history
Component registry - support both pure function component and class components
  • Loading branch information
martinpovolny authored May 15, 2018
2 parents 8ba5ee0 + 574e8ca commit 6ae6bf2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/javascript/miq-component/react-blueprint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
// should fix the problem

export default (
reactElementCreator: (props: ComponentProps) => any /* ReactElement */,
ReactElement: (props: ComponentProps) => any,
mapPropsToInteract: (props: ComponentProps) => any = () => undefined
): ComponentBlueprint => {
function render(props: ComponentProps, container: HTMLElement) {
ReactDOM.render(
<Provider store={ManageIQ.redux.store}>
{reactElementCreator(props)}
<ReactElement {...props} />
</Provider>,
container
);
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packs/component-definitions-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import React from 'react';
/**
* Add component definitions to this file.
* example of component definition:
* ManageIQ.component.addReact('ComponentName', props => <ComponentName {...props} />);
* ManageIQ.component.addReact('ComponentName', ComponentName);
*/

0 comments on commit 6ae6bf2

Please sign in to comment.