Skip to content

Instantly share code, notes, and snippets.

View fadihanna123's full-sized avatar
πŸ‘¨β€πŸ’»
Always Coding :)

Fadi Hanna fadihanna123

πŸ‘¨β€πŸ’»
Always Coding :)
View GitHub Profile
const materialTypeReducer = (acc: { [materialType: string]: number }, current: Silo) => {
const material = current.material.replace(" ", "");
if (Object.keys(acc).indexOf(material) === -1) {
acc[material] = current.weight;
}
else {
acc[material] += current.weight;
} return acc;
};
import "./config/database";
import UserRoutes from "./api/AuthRoutes";
import { server } from "./config/GlobalSettings";
server.use(UserRoutes);
const port: number = 5000;
server.listen(port, () =>
console.log(` \n Server started on port ${port} \n `)
// File 1
import getCompanyName from "./Functions";
const Config = () => {
let getname = getCompanyName() ? getCompanyName() : "Gssons EL AB";
};
export default Config;
// File 2
import getname from "./Includes/Config";
import React, { useState } from "react";
const App = () => {
const [form, setForm] = useState({ uname: "", cars: "", sex: "" });
const typer = (e) => {
setForm({ ...form, [e.target.name]: e.target.value });
};
const Show = () => {
console.log(form);
};
return (