Skip to content

Instantly share code, notes, and snippets.

View Manntrix's full-sized avatar
🏠
Working from home

React Developer Manntrix

🏠
Working from home
View GitHub Profile
import { useRouter } from "next/router";
const PathName = () => {
// destructuring asPath from next js useRouter hook to get the current path name
const { asPath } = useRouter();
// if path name returns slash it should be home
if (asPath == "/") {
var path = "home";
} else {
import { SketchPicker, BlockPicker } from "react-color";
import { useState } from "react";
function App() {
//creating state to store our color and also set color using onChange event for sketch picker
const [sketchPickerColor, setSketchPickerColor] = useState({
r: "241",
g: "112",
b: "19",
a: "1",
import { BlockPicker } from "react-color";
import { useState } from "react";
function App() {
//creating state to store our color and also set color using onChange event for block picker
const [blockPickerColor, setBlockPickerColor] = useState("#37d67a");
return (
<div className="App">
import "./App.css";
import { useState } from "react";
import Papa from "papaparse";
function App() {
// State to store parsed data
const [parsedData, setParsedData] = useState([]);
//State to store table Column name
const [tableRows, setTableRows] = useState([]);
const changeHandler = (event) => {
// Passing file data (event.target.files[0]) to parse using Papa.parse
Papa.parse(event.target.files[0], {
header: true,
skipEmptyLines: true,
complete: function (results) {
console.log(results.data)
},
});
};
import "./App.css";
function App() {
const changeHandler = (event) => {
console.log(event.target.files[0])
};
return (
<div>
{/* File Uploader */}
<input
import "./App.css";
function App() {
return (
<div>
{/* File Uploader */}
<input
type="file"
name="file"
accept=".csv"
import "../styles/globals.css";
import { wrapper, store } from "../store/store";
import { Provider } from "react-redux";
function MyApp({ Component, pageProps }) {
return (
<>
<Provider store={store}>
<Component {...pageProps} />
</Provider>
import { createStore, applyMiddleware } from "redux";
import thunk from "redux-thunk";
import { composeWithDevTools } from "redux-devtools-extension";
import { createWrapper } from "next-redux-wrapper";
import rootReducer from "./reducers";
// initial states here
const initalState = {};
// middleware
@Manntrix
Manntrix / app.js
Last active January 24, 2022 17:59
import "./App.css";
import { BsMoonStarsFill, BsFillSunFill } from "react-icons/bs";
import { useDispatch, useSelector } from "react-redux";
import { useEffect } from "react";
import { handledarkMode } from "./store/actions/darkModeAction";
function App() {
// assigning useDispatch hook of redux to a variable
const dispatch = useDispatch();