I have trouble looking for a solution on how to read a properties file in reactJS.
I've read that you can use the module "properties-reader" but I can't seem to make the require work. Is there a simple way ?
For example,
import React, { Component } from "react";
import './properties.file';
// var propertiesUser = properties.get('user');
class Main extends Component {
render() {
// Change title
document.title = "Milo's Collection"
return (
<div>
{propertiesUser}
</div>
);
}
}
export default Main;
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
Can anyone help me? Thanks in advance guys!
Here's a simple way to import/export an object (in a .js file) so you can re-use it across multiple files:
Then in your react component: