-
var
๋function-scoped
์ด๊ณ ,let
,const
๋block-scoped
์ ๋๋ค. -
function-scoped
์block-scoped
๊ฐ ๋ฌด์จ๋ง์ด๋?
import {forwardRef, useImperativeHandle, ForwardRefExoticComponent, RefAttributes, Ref} from "react"; | |
export type Handle<T> = T extends ForwardRefExoticComponent<RefAttributes<infer T2>> ? T2 : never; | |
export const Parent = (props: {})=> { | |
let childHandle: Handle<typeof Child>; | |
return ( | |
<div onClick={()=>childHandle.SayHi()}> | |
<Child name="Bob" ref={c=>childHandle = c}/> | |
</div> |
const mapItemSchema = new mongoose.Schema({ | |
name: String, | |
location: { | |
// It's important to define type within type field, because | |
// mongoose use "type" to identify field's object type. | |
type: {type: String, default: 'Point'}, | |
// Default value is needed. Mongoose pass an empty array to | |
// array type by default, but it will fail MongoDB's pre-save | |
// validation. | |
coordinates: {type: [Number], default: [0, 0]} |
I've been using create-react-app lately as I find it very useful to kick things off while starting a project. I almost always follow JavaScript Standard Style and I found myself googling it so I figured out I should write it down.
I really like keeping dependencies as local as possible but if you prefer you can install it globally.
yarn add standard --dev
or
// See https://blog.isquaredsoftware.com/presentations/react-redux-ts-intro-2020-12/#/36 for slides | |
// My basic render function structure: | |
function RenderLogicExample({ | |
someBoolean, // 1) Destructure values from `props` object | |
someList, | |
}) { | |
// 2) Declare state values | |
const [a, setA] = useState(0); | |
const [b, setB] = useState(0); |
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |
Hi Nicholas,
I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:
The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't
์๋ ํ์ธ์. ์ฌ์์ฌ์ ๋ถ์ ๋ง๋ฃจ์ผ๋ง@h13i32maru์ ๋๋ค. ์ต๊ทผ์ Web ํ๋ก ํธ์๋์ ๋ณํ๋ ๋งค์ฐ ๊ฒฉ๋ ฌํด์, ์กฐ๊ธ ๋์ ๋ ์ฌ์ด์ ์ ์ ์๋ก์ด ๊ฒ์ด ๋์ค๊ณ ์๋๋ผ๊ตฌ์. ๊ทธ๋ฐ ๊ฒฉ๋ ฌํ ๋ณํ์ค ํ๋๊ฐ ES6์ด๋ผ๋ ์ฐจ์ธ๋ JavaScript์ ์ฌ์์ ๋๋ค. ์ด ES6๋ ํ์ฌ ์ฌ์ ์ค์ผ๋ก ์งํ์์ ์์๋ Draft Rev31์ด ๊ณต๊ฐ๋์ด์์ต๋๋ค.
JavaScript๋ ECMAScript(ECMA262)๋ผ๋ ์ฌ์์ ๊ธฐ๋ฐ์ผ๋ก ๊ตฌํ๋์ด์์ต๋๋ค. ํ์ฌ ๋ชจ๋ํ Web ๋ธ๋ผ์ฐ์ ๋ ECMAScript 5.1th Edition์ ๊ธฐ๋ฐ์ผ๋ก ํ JavaScript์คํ ์์ง์ ํ์ฌํ๊ณ ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋ค์ ๋ฒ์ ์ธ ECMAScript 6th Edition์ด ํ์ฌ ์ฌ์ ์ค์ผ๋ก, ์ฝ์นญ์ผ๋ก ES6์ด๋ผ๋ ๋ช ์นญ์ด ์ฌ์ฉ๋๊ณ ์์ต๋๋ค.
EMOJI CHEAT SHEET
Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. โ Got flash enabled? Click the emoji code and it will be copied to your clipboard.
People
๐
#add 'node_modules' to .gitignore file | |
git rm -r --cached node_modules | |
git commit -m 'Remove the now ignored directory node_modules' | |
git push origin <branch-name> |