import * as React from "react";
export default class App extends React.Component {
constructor(props) {
super(props)
this.state = {
data: ''
};
}
componentDidMount() {
let self = this;
fetch('http://blog.domain.com/admin.php')
.then(function (response) {
return response.text()
}).then(function (text) {
console.log(text)
self.setState({
data: text
});
})
}
render() {
return (<div dangerouslySetInnerHTML={{__html: this.state.data}}></div>
);
}
}
Thursday, December 29, 2016
React.js - fetching html from a URL and setting it in an element
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2016
(67)
-
▼
December
(10)
- react.js with PHP, cookies/CORS/session id etc
- React.js Routes and Navigation Bar
- React.js - fetching html from a URL and setting it...
- installing nodejs on Amazon Linux
- higher order components(HOC) in react
- react.js read further
- react.js
- buying/purchasing a wildcard ssl certificate
- renew letsencrypt certs
- React.js fundamentals
-
▼
December
(10)
No comments:
Post a Comment