Skip to content

Instantly share code, notes, and snippets.

View akulsr0's full-sized avatar

Akul Srivastava akulsr0

View GitHub Profile
@akulsr0
akulsr0 / data.json
Last active June 16, 2024 14:54
Demo CMS
{
"name": "Akul Srivastava 123",
"header": {
"title": "welcome to my page"
},
"footer": {
"title": "Thanks for visiting",
"description": "Come back soon!"
}
}
@akulsr0
akulsr0 / greet-component.js
Created June 29, 2022 12:25
Test component via cdn
export function Greet({ name }) {
return <h3>Hello, {name}</h3>;
}

Modules, importing and exporting

CommonJS

Exporting a variable

// user.js
exports.name = "John";
declare function sum(x: number, y: number): string;

Using Redux in ReactJS

  1. Install redux and react-redux

  2. Create state (src/redux/state.js)

// src/redux/state.js

export const numState = {
@akulsr0
akulsr0 / quotes.json
Created February 23, 2022 14:30
Quotes
[
{
"text": "Genius is one percent inspiration and ninety-nine percent perspiration.",
"author": "Thomas Edison"
},
{
"text": "You can observe a lot just by watching.",
"author": "Yogi Berra"
},
{
@akulsr0
akulsr0 / RNAnims - Winner Animation.js
Created September 1, 2021 14:59
RNAnims - Winner Animation
import * as React from "react";
import {
View,
Animated,
Image,
TouchableOpacity,
Text,
Dimensions,
StyleSheet,
} from "react-native";
@akulsr0
akulsr0 / RNUIAPP - Emoji.jsx
Created October 31, 2020 07:32
React Native UI - Emoji
import React, { useState } from 'react';
import {
View,
TextInput,
} from 'react-native';
import Emoji from 'react-native-emoji';
export default function App() {
@akulsr0
akulsr0 / RNUIAPP - PaymentScreen2.jsx
Created October 30, 2020 05:29
React Native UI - Payment Screen 2
import React, { useState } from 'react';
import {
StyleSheet,
Text,
View,
StatusBar,
Image,
TouchableOpacity,
ActivityIndicator,
ScrollView,
@akulsr0
akulsr0 / RNUIAPP - ContactsScreen.jsx
Created October 30, 2020 05:27
React Native UI - Contacts Screen
import React, { useState, useEffect } from 'react';
import {
ActivityIndicator,
StatusBar,
Image,
Text,
TouchableOpacity,
Alert,
View,
} from 'react-native';