Comments (3)
Ok this makes sense! thank you for explaining
from tng-hooks.
The TNG (pronounced "ting") name has a few meanings/reasons:
-
It started as "totally not globals" -- a nod to the idea that it's like having global storage but not-global because it's in closures
-
I planned a talk to introduce TNG, called "State Track: The Next Generation" (a nod to star trek TNG, etc)
-
It's hard to get unique names on npm these days, especially in the realm of react/hooks/etc. TNG is a nice unique moniker.
My thought was, if people didn't like using the name TNG, they can always call it some other name. In node: var { TNG: coolHooks, .. } = require("tng-hooks");
. In the browser, window.coolHooks = window.TNG;
.
from tng-hooks.
Why not "makeHooks" or import { useState } from 'fn-hooks'? etc. To invoke everything with "TNG" doesn't seem meaningful language-wise.
I don't have TNG exporting itself as an ES6 module yet, but the various hooks, like useState(..)
, etc, are in fact individual "exports" on the API of this lib. You don't say TNG.useState(..)
, you just say useState(..)
(just like in React).
That's why in node you do var {TNG,useState,useEffect} = require("tng-hooks");
, because you're individually "importing" each of those "exported" identifiers as you see fit.
The only time you use the TNG
name itself is for the function that creates the wrapped/hooked functions (aka "Articulated Functions"). And as I said above, if you don't like saying myFunc = TNG(myFunc);
, you can rename TNG to whatever you prefer, like makeHooks(..)
or whatever, and then say myFunc = makeHooks(myFunc);
.
from tng-hooks.
Related Issues (20)
- Support: function passed to a setter/updater
- Support: `useRef(..)` hook HOT 1
- useState(..) Hook example uses ++ in a confusing way HOT 2
- Feature: `useDebounce(..)` and `useThrottle(..)` HOT 3
- Feature: hooks fire events HOT 1
- Feature: `usePromisify(..)` HOT 6
- Feature: `useDeferred()`
- Feature: `useRender(..)` HOT 3
- Support: useReducer(..) hook
- Change: externalize TNG hooks-context HOT 11
- useEffect that works with DOM/UI HOT 15
- why `tngStack` HOT 3
- confusing phonetic transcription HOT 4
- Support: useEffect(..) hook HOT 21
- v1.x and v2.x do not work in a browser
- Refactor useState (or useReducer) HOT 1
- html test runner is broken
- Name Bikeshedding HOT 6
- Further clarification for useEffect() hook HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tng-hooks.