@leafnet/calculatorview-react
v1.9.1
Published
ICU Tools and Calculator components
Downloads
11
Readme
Introduction
Used in internal projects. Not ment
Install
npm install @leafnet/calculatorview-react
Data
Add data in assets
folder and configure webpack.config.js as follows
devServer: {
...,
static: ["assets"],
},
Use
import ReactDOM from "react-dom/client";
import { LfMortalityCalculatorComplex } from "@leafnet/calculatorview-react";
import { useEffect, useState } from "react";
const root = ReactDOM.createRoot(document.getElementById("root"));
const RootElement = () => {
const [dataFromInternet, setDataFromInternet] = useState();
useEffect(() => {
const loadData = async () => {
let data = await fetch("/sofa.json");
data = await data.json();
console.log(data);
setDataFromInternet(data);
};
loadData();
}, []);
return (
dataFromInternet && (
<>
<LfMortalityCalculatorComplex
dataFromInternet={dataFromInternet}
isHidden={false}
handleEvent={null}
></LfMortalityCalculatorComplex>
</>
)
);
};
root.render(<RootElement />);