Skip to content

Instantly share code, notes, and snippets.

View wildfrontend's full-sized avatar
:shipit:
something need to do

louis.luo wildfrontend

:shipit:
something need to do
  • Gosugamers
  • Taichung
View GitHub Profile
@wildfrontend
wildfrontend / bulma-react-router.md
Last active September 30, 2020 03:54
How to use bulma tabs active class name on the parent element with React router

jgthms/bulma#3129

answer:

  const setParentAsActive = (node: any) => {
    if (node) {
 node.parentNode.className = node.className
@wildfrontend
wildfrontend / why we dont need to use --save-dev.md
Last active September 11, 2020 15:21
why we dont need to use `npm install --save-dev`

As of NPM 5, saving is done by default

--save-dev is only needed if we’re building a node app;

since we output minified JS for production via npm run build, everything is a dev dependency,

so it doesn’t actually matter in practice whether modules are added to dependencies or devDependencies in package.json.

prepare

  • rewrite fetch to catch httpcode
const httpCodeFetch = async ({ url, config = initialConfig }) => {
    const res = await fetch(url, config)
    if (res.status === 204) return {}
    if (res.ok) {
 return res.json()
@wildfrontend
wildfrontend / AppendComponent.js
Created July 16, 2020 05:44
create dymanic component
const App = () =>{
const [conunt,setConunt] = useState(1)
return (
<div>
{Array(conunt).fill(<RepeatCompnent/>)}
</div>
)
}
function blobToDataURI(blob, callback) {
const reader = new FileReader()
reader.readAsDataURL(blob)
reader.onload = function (e) {
callback(e.target.result)
}
}
@wildfrontend
wildfrontend / README.md
Created June 5, 2020 15:09
tailwind.css with css-in-jss , react setup
@wildfrontend
wildfrontend / App.js
Last active April 9, 2020 02:47
redux config
import React from 'react'
import ReactDOM from 'react-dom'
import { StoreContext } from 'redux-react-hook'
import App from './App'
import store from './store/configureStore'
import prestate from './store/prestate'
const app = (state = {}) => {
ReactDOM.render(
@wildfrontend
wildfrontend / gitconfig.sh
Created March 26, 2020 07:59
git usernam and email sh
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="要修改的email"
CORRECT_NAME="正確的user.name"
CORRECT_EMAIL="正確的user.email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
@wildfrontend
wildfrontend / commend.md
Created March 9, 2020 06:12
storybook config
npm install @storybook/react --save-dev
npm install @storybook/addons @storybook/addon-actions @storybook/addon-knobs @storybook/addon-notes --save-dev