Skip to content

Instantly share code, notes, and snippets.

View dmiller9911's full-sized avatar

Doug Miller dmiller9911

View GitHub Profile
@dmiller9911
dmiller9911 / webpack.config.js
Created March 13, 2019 19:12
React Webpack Config Starter
const { join, resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const srcDir = resolve(__dirname, './src');
const distDir = resolve(__dirname, './dist');
const publicDir = resolve(__dirname, './public');
const appIndexFile = join(publicDir, 'index.html');
@dmiller9911
dmiller9911 / Links.md
Last active August 22, 2018 15:18
HCCM Links
@dmiller9911
dmiller9911 / Patternfly 4 React RFC.md
Last active August 2, 2018 14:26
Patternfly 4 React RFC
  • Start Date: 05-22-2018

Summary

Provide an approach that allows patternfly-react to consume patternfly-next. This approach will cover the following items:

  1. Keep patternfly-react in sync with patternfly-next core
  2. Make it easy for consumers to include patternfly-react in their projects
    • Enable code-splitting without workarounds
    • No need for extra Webpack loaders
  • No CSS to import
@dmiller9911
dmiller9911 / pf-react-next-rfc.md
Last active August 15, 2018 14:51
RFC for updating pf-react(current) to next
  • Start Date: 05-22-2018

Summary

Provide an approach that allows patternfly-react to consume patternfly-next. This approach will cover the following items:

  1. Keep patternfly-react in sync with patternfly-next core
  2. Make it easy for consumers to include patternfly-react in their projects
    • Enable code-splitting without workarounds
    • No need for extra Webpack loaders
  • No CSS to import
@dmiller9911
dmiller9911 / reactChildrenMap.jsx
Created January 30, 2017 02:53
React.Children.map example
import React from 'react';
import * as ReactDOM from 'react';
let notifications = [];
function addNotification(notification) {
notifications = [...notifications, notification];
}
function removeNotification(notification) {
const index = notifications.indexOf(notification);
@dmiller9911
dmiller9911 / reactSlotExample.jsx
Created January 30, 2017 02:42
React Slot Example
import React from 'react';
import ReactDOM from 'react-dom';
function Slot({ children, slot }) {
let slottedChild = null; // Default to null since react can render null if a slot isn't found
// Iterate over children to find the slot needed
React.children.forEach(children, (child) => {
if (!React.isValidElement(child)) { // Check that it is a valid react element.
return; // Return since we can't do anything with a child without props.
}
@dmiller9911
dmiller9911 / React Child Structure
Last active January 24, 2017 03:48
Basic structure of a React Child
{
$$typeof: Symbol(React.element),
key: null | key,
props: {},
ref: Function,
type: Function | Class | string,
}