Skip to content

Instantly share code, notes, and snippets.

View GunaShekar02's full-sized avatar

Guna Shekar Proddaturi GunaShekar02

View GitHub Profile
@GunaShekar02
GunaShekar02 / App.js
Created May 29, 2020 22:12
The parent component
import React from "react";
import { RecoilRoot } from "recoil";
import Details from "./components/Details/Details";
import Sidebar from "./components/Sidebar/Sidebar";
import "./App.css";
function App() {
return (
@GunaShekar02
GunaShekar02 / Sidebar.js
Last active June 9, 2020 20:18
Sidebar Component
import React, { Suspense } from "react";
import ContactsList from "../ContactList/ContactList";
import styles from "./Sidebar.module.css";
const Sidebar = () => {
return (
<div className={styles.container}>
<h2 className={styles.title}>Contacts Menu</h2>
import { atom } from "recoil";
export const currentContactState = atom({
key: "currentContactState",
default: 1,
});
import { selector } from "recoil";
import { currentContactState } from "./atoms";
import { getContacts, getDetails } from "../data";
export const contactsList = selector({
key: "contactsList",
get: async () => {
const response = await getContacts();
return response;
import React from "react";
import { useRecoilState, useRecoilValue } from "recoil";
import styles from "./ContactList.module.css";
import { currentContactState } from "../../recoil/atoms";
import { contactsList } from "../../recoil/selectors";
const ContactList = () => {
const [currentContact, setCurrentContact] = useRecoilState(currentContactState);
import React, { Suspense } from "react";
import Card from "../Card/Card";
import styles from "./Details.module.css";
const Details = () => {
return (
<div className={styles.container}>
<div className={styles.card}>
import React from "react";
import { useRecoilValue } from "recoil";
import { currentContactDetails } from "../../recoil/selectors";
const Card = () => {
const contact = useRecoilValue(currentContactDetails);
return (
<>
@GunaShekar02
GunaShekar02 / index.js
Last active January 16, 2021 14:08
Firebase Cloud Messaging - Push Notifications
const Express = require("express");
const bodyParser = require("body-parser");
const admin = require("firebase-admin");
const serviceAccount = require("./firebase.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});