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
  • DG
  • Taichung
View GitHub Profile
@wildfrontend
wildfrontend / README.md
Created June 5, 2020 15:09
tailwind.css with css-in-jss , react setup
@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()

remix-run/react-router#4685

  1. add in
  2. add Global 404
Hey guys, so today I've came across this exact same issue and I was able to get something working to render a "global not found" component, while keeping the benefits of sharing some UI within a "parent" route. I wanted to share this with you, in case you find this useful for your case :)

Consider the routes I need to support:
@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)
}
}