Skip to content

Instantly share code, notes, and snippets.

@mycolaos
mycolaos / CreatableAutocomplete.tsx
Last active February 1, 2024 15:42
Creatable Autocomplete simplifying the MUI Autocomplete usage.
/**
* This is a CreatableAutocomplete component that can be used to create new
* options using MUI's Autocomplete component.
*
* Motivation: the MUI interface for creatable autocomplete is complex and hard
* to follow, this component simplifies the interface by separating the event of
* selecting an option from the event of creating a new option.
*
* Usage copy-paste it and use it like this:
*
@mycolaos
mycolaos / index.html
Created August 30, 2017 12:16
SPA html
<!doctype html>
<html>
<head>
<title>Fearless</title>
</head>
<body>
<div id='root'></div>
<script src='bundle.js'></script>
</body>
</html>
@mycolaos
mycolaos / file structure
Last active March 2, 2023 15:06
initial file structure
/src
index.js
/dist
index.html
# bundle.js will be created automatically when you run `npm run build`
package.json
{
"presets": [
["env", { "modules": false }],
"react",
"stage-0"
],
"plugins": [
"react-hot-loader/babel"
],
@mycolaos
mycolaos / index.js
Created August 4, 2017 13:47
React Hot Loader
import { AppContainer } from 'react-hot-loader';
import React from 'react';
import ReactDOM from 'react-dom';
import Root from './Root.dev';
import configureStore from './store/configureStore.dev'
const store = configureStore()
const rootEl = document.getElementById('root');
const render = Component =>
{
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"
],
{
"plugins": {
"autoprefixer": {}
}
}
{
"presets": [
["env", {"modules": false}],
"react",
"stage-0"
]
}
const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
{
"name": "Mycolaos",
"version": "1.0.0",
"scripts": {
"build": "webpack"
},
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.5",