blob: aee96e9e68d1897048cb4de65f67dddf176cae6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import React, { useState } from 'react';
import axios from 'axios';
import Section from './Section';
interface PropTypes {
data?: string;
url?: string;
}
const Markdown: React.FC<PropTypes> = ({ data, url }) => {
const [markdown, setMarkdown] = useState<string>(data || '');
if (url) axios.get(url).then(response => setMarkdown(response.data));
return <Section rawLines={markdown.split('\n')} />
};
export default Markdown;
|