Skip to content

Instantly share code, notes, and snippets.

View Mohammad-Faisal's full-sized avatar
🎯
Focusing

Mohammad Faisal Mohammad-Faisal

🎯
Focusing
View GitHub Profile
it('Test navigation' , () => {
const ui = renderConnected(
<>
<FirstPage />
<Route path="/second-page">Second Page</Route>
</>,
{ initialState }
);
expect(screen.queryByText('Second Page')).toBeNull();
import {fetchData , putData} from './AwsFunctions';
export default const App = () => {
const fetchDataFormDynamoDb = async () => {
await fetchData('users')
}
const addDataToDynamoDB = async () => {
const userData = {
import {fetchData} from './AwsFunctions';
export default const App = () => {
const fetchDataFormDynamoDb = () => {
fetchData('users')
}
return <>
<button onClick={() => fetchDataFormDynamoDb()}> Fetch </button>
function generatePreSignedGetUrl( fileName , fileType) {
myBucket.getSignedUrl('getObject', {
Key: fileName,
ContentType: fileType,
Expires: URL_EXPIRATION_TIME
} , (err , url) => {
return url // API Response Here
});
}
import React from 'react';
import styles from './layout.module.css'
export default function Layout({children}) {
return <div className={styles.container}>{children}</div>
}
import React from 'react';
import Link from "next/link";
export default function Home() {
return <div>
<Link href={'about'}>Go to About Page</Link>
</div>
}
import React from 'react';
export default function Home() {
return <div>Home Page</div>
}
import firebase from 'firebase'
export const useFirebaseNotificationProvider = () => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('./firebase-messaging-sw.js')
.then(function (registration) {
console.log('Registration successful, scope is:', registration.scope)
})
.catch(function (err) {
console.log('Service worker registration failed, error:', err)
export default function App () {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('firebase-messaging-sw.js')
.then(function(registration) {
console.log('[SW]: SCOPE: ', registration.scope);
return registration.scope;
})
.catch(function(err) {
importScripts('https://www.gstatic.com/firebasejs/7.14.2/firebase-app.js')
importScripts('https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js')
const config = {
apiKey: "API_KEY",
authDomain: "PROJECT_ID.firebaseapp.com",
databaseURL: "https://PROJECT_ID.firebaseio.com",
projectId: "PROJECT_ID",
storageBucket: "PROJECT_ID.appspot.com",
messagingSenderId: "SENDER_ID",