Hi guys ๐! Long time no new articles!
Today, I am going to show you how to compose React providers with TypeScript.
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.
| { | |
| "recommendations": [ | |
| "aaron-bond.better-comments", | |
| "adrieankhisbe.vscode-ndjson", | |
| "johnsoncodehk.vscode-tsconfig-helper", | |
| "rbuckton.deoptexplorer-vscode", | |
| "helixquar.randomeverything", | |
| "WallabyJs.quokka-vscode", | |
| "bierner.comment-tagged-templates", | |
| "alexcvzz.vscode-sqlite", |
Beginning with devices using an A12 SoC or higher, Apple introduced nonce entangling.
libkernrw.libkrw.| module.exports = { | |
| webpack: { | |
| configure: (webpackConfig) => ({ | |
| ...webpackConfig, | |
| module: { | |
| ...webpackConfig.module, | |
| rules: webpackConfig.module.rules.map((rule) => { | |
| if (!rule.oneOf) return rule; | |
| return { | |
| ...rule, |
์์ฆ๋ค์ด "~๋ก ๋ก๊ทธ์ธํ๊ธฐ" ๊ฐ ๋ง์์ง๊ณ ์๋ค. ํ์ด์ค๋ถ์ด๋ ๊ตฌ๊ธ์ด ๋ํ์ ์ด๊ณ , ํ๊ตญ์์๋ ๋ค์ด๋ฒ๋ ๋ง์ด ์ฌ์ฉํ๋ฉฐ ๊ฐ๋ฐ์ ๊ด๋ จ ์น์์๋ ๊นํ๋ธ๋ ๊ปด์๋ ๊ฒฝ์ฐ๊ฐ ๋ง๋ค. ์ด๋ฐ ์์ ๋ค๋ฅธ ์๋น์ค๋ฅผ ํตํด ์ธ์ฆํ๋ ๋ฐฉ์์, OAuth ์ธ์ฆ ๋ฐฉ์์ด๋ผ๊ณ ํ๋ ๋ชจ์์ด๋ค. ๋ด๊ฐ ํ์ฌ ์ ๋ฌด๋ฅผ ์ํด ์ฌ์ฉํ๋ ๋ช๋ช ์ํํธ์จ์ด๋ ์ด๋ฌํ ์ธ์ฆ์ ์ง์ํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง๋ค. ์ด ๊ธ์์๋ ๊ทธ๋ฌํ ์ธ์ฆ์ ๊ตฌํํ์ง๋๊ฒ ์๋๋ผ ๊ทธ๋ฌํ ์ธ์ฆ์ ์ฌ์ฉํด ๋ณด์๋ ๊ฒ์ ๋ชฉ์ ์ ๋๋ค. ์ด๋ค ๋ฐฉ์์ผ๋ก ์ธ์ฆํ๋์ง๋ฅผ ์ง์ ์ฌ์ฉํด๋ณด๊ณ OAuth๋ฐฉ์ ์ธ์ฆ์ ์ ์ฐจ๋ฅผ ์์๋ณด๋ ๊ธฐํ๋ ๋ ๊ฒ์ด๋ค.
์์ ๊ฐ์ด ๋ฒํผ์ ๋๋ฅด๋ฉด Github์์ ์ธ์ฆ์ ์คํํ๊ณ ๊ด๋ จ ๋ฐ์ดํฐ๋ฅผ ๋ฐ์์ค๋ ๋์์ ๊ตฌํํด ๋ณผ ๊ฒ์ด๋ค.
Note: There are better ways to do this by now. Check https://docs.docker.com/develop/develop-images/build_enhancements/#new-docker-build-secret-information for details
In order to access packages in private github repositories a Dockerfile might contain statements like this:
RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
RUN npm install --ignore-scripts --quiet && npm cache clean --force
RUN git config --global --unset url."https://${GITHUB_TOKEN}@github.com/".insteadOf
| // Gulp Task | |
| gulp.task("compile:source", function(done) { | |
| gutil.log(gutil.colors.yellow("[Typescript]"), gutil.colors.magenta('Transpiling Source')); | |
| var tsProject = ts.createProject('tsconfig.json', { | |
| typescript: require('typescript'), | |
| }); | |
| gulp.src("source/**/*") | |
| .pipe(tsProject()) | |
| .pipe(tsimport(tsProject.config.compilerOptions)) |
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); |
| class EventEmitter | |
| /// Shared Instance. | |
| public static var sharedInstance = EventEmitter() | |
| // ReactNativeEventEmitter is instantiated by React Native with the bridge. | |
| private static var eventEmitter: ReactNativeEventEmitter! | |
| private init() {} |