Skip to content

Instantly share code, notes, and snippets.

View chenkie's full-sized avatar

Ryan Chenkie chenkie

View GitHub Profile
...
return (
<Provider
value={{
authState,
setAuthState: authInfo => setAuthInfo(authInfo)
}}
>
{children}
[
{
"name": "T-Shirt",
"description": "Great fit, super comfy",
"image": "https://i.imgur.com/KeQtXT3.png",
"price": 25,
"sku": "123"
},
{
"name": "Sweater",
import React, { useState } from 'react';
// types and interfaces for props
type DashboardProps = {
totalSales: number;
};
const Dashboard: React.FC<DashboardProps> = (props) => (
<section>
<p>Total Sales: {props.totalSales}</p>
interface FunctionComponent<P = {}> {
(props: PropsWithChildren<P>, context?: any): ReactElement<any, any> | null;
propTypes?: WeakValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: Partial<P>;
displayName?: string;
}
import { PrismaClient } from '@prisma/client';
const prisma = global.prisma || new PrismaClient();
if (process.env.NODE_ENV === 'development') global.prisma = prisma;
export default prisma;
// get all tweets from @prisma
from:prisma
// tweets between two accounts
from:ryanchenkie to:chris__sev
// tweets by a hashtag but only with images
#InaugurationDay filter:images
// keywords by people on a specific list

One of my favorite things about Vue.js is how approachable it is. We can simply drop the library into an existing project, create a Vue instance with an element or ID of our choosing as a selector, and we're all set to add reactivity to the page. This simplicity is great and comes in handy if we just want to use a few of Vue's features, but there's actually a lot more we can do with the library that some people may not be aware of.

Surrounding the core Vue.js library is a rich ecosystem of tools and plugins that allow us to create full single page applications. Vue also offers full support for ES2015 and comes with its own file type: the .vue component, which is great because it allows us to have our template, scripts, and styles all in the same file. While some might say that this could be cumbersome and file sizes could get huge, I would argue that the number of clicks and amount of mental bandwidth (even if small) that we save by using this kind of format makes it quite valuable.

This is the secon