Skip to content

Instantly share code, notes, and snippets.

View tricoder42's full-sized avatar
🕴️
I may be slow to respond.

tricoder42

🕴️
I may be slow to respond.
View GitHub Profile
@tricoder42
tricoder42 / app.js
Last active October 19, 2018 17:55 — forked from NgesBrian/app.js
error message is this.props.language is undefined
import React, { Component } from 'react';
import './App.css';
import { connect } from 'react-redux';
import Main from './Main/Main.js';
import FooterPage from './Footer/Footer.js';
import { I18nProvider } from '@lingui/react'
class App extends Component {
@tricoder42
tricoder42 / example.ts
Created April 25, 2019 08:15
Next.js Route Configs
// I believe this file could be automatically generated. Each route
// could be typechecked that all params are passed into it.
import { projectRoute } from "routes.js"
import { ProjectLink } from "routes.utils.ts"
export const ProjectLink = makeLink(projectRoute)
// Example usage of `ProjectLink` component. It's like regular Link, but it accepts `params`
// which are injected into `routeConfig.as` pattern.
@tricoder42
tricoder42 / README.md
Last active February 10, 2023 08:54
Centralized routing for Next.js

I'm using this approach to have centralized route config in Next.js. I don't have the fully automated solution. Right now I'm writing route configs and links manually to figure out if it works and what are the drawbacks.

I believe the automation is the last step to make it completely seamless.

1. Define routes in centralized config

This is the only file that needs to be wrote manually.

@tricoder42
tricoder42 / README.md
Last active May 29, 2019 16:29
Webpack plugin which injects code, module dependency and async context to each chunk

I'm writing a webpack plugin, which should generate message catalogs for each chunk.

✅ I know how to split main message catalog by inspecting modules inside chunk.

In build folder, I have:

index.js
index.en.js
index.cs.js