Skip to content

Commit

Permalink
fix(resolver-react): using html data type for beautified baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
Igmat committed Mar 1, 2018
1 parent 8689b29 commit 36369eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/baset-resolver-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { AbstractResolver } from 'baset-core';
import { AbstractResolver, dataTypes } from 'baset-core';
import React from 'react';
import ReactDOM from 'react-dom/server';

export default class ReactResolver extends AbstractResolver {
match = async (obj: any) =>
React.isValidElement(obj);
resolve = async (obj: any) =>
ReactDOM.renderToString(obj);
resolve = async (obj: any) => ({
value: ReactDOM.renderToString(obj),
[dataTypes.html]: 'react',
});
}

0 comments on commit 36369eb

Please sign in to comment.