yarn create react-app --template typescript
- remove nodeLinker from .yarnrc.yml
yarn dlx @yarnpkg/sdks vscode
yarn plugin import typescript
- import '@testing-library/jest-dom' in test file
- "typeRoots": ["typing"] in tsconfig.json
- remove eslint config in package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, ChangeEvent } from 'react'; | |
// props -н төрлийг зааж өгж байна | |
type propsTypes = { | |
name: string | |
} | |
// state -н төрлийг зааж өгч байна | |
type stateTypes = { | |
name: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
// props -н төрлийг зааж өгж байна | |
type propsTypes = { | |
name: string | |
} | |
const App = (props: propsTypes) => { | |
return ( | |
<div> | |
<h1>Name: {props.name}</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"folders": [ | |
{ | |
"path": "formik-ck" | |
} | |
], | |
"settings": { | |
"workbench.colorCustomizations": { | |
"statusBar.background": "#787CB5", | |
"titleBar.activeBackground": "#787CB5" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongoose from 'mongoose'; | |
mongoose.connect('mongodb://localhost:27017/mongotest', { useNewUrlParser: true }); | |
const db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error:')); | |
db.once('open', function () { | |
// we're connected! | |
console.log("MongoDB connected"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Middleware; | |
use Psr\Http\Message\ResponseInterface; | |
use Psr\Http\Message\ServerRequestInterface; | |
use Psr\Http\Server\MiddlewareInterface; | |
use Psr\Http\Server\RequestHandlerInterface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { StatusBar } from 'expo-status-bar'; | |
import React, { useState, useEffect, useRef } from 'react'; | |
import { Platform, StyleSheet, TouchableOpacity } from 'react-native'; | |
import { Camera } from 'expo-camera'; | |
import { Text, View } from '../components/Themed'; | |
import { FontAwesome5 } from '@expo/vector-icons'; | |
export default function ModalScreen() { | |
const [hasPermission, setHasPermission] = useState(false); |
OlderNewer