Front-end development toolkit.
My other user code snippet plugin: Big Lvan
Prefix | Method |
---|---|
hus , useState |
const [state, setState] = useState(initialState) |
huc , useContext |
const context = useContext(initialContext) |
hur , useRef |
const refContainer = useRef(initialRef) |
useEffect(() => {
componentDidMount || componentDidUpdate;
return () => {
componentWillUnmount;
};
}, [input]);
const memoizedCallback = useCallback(() => {
// doSomething(a, b);
}, [a, b]);
const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);
const [state, dispatch] = useReducer(reducer, initialArg, init);
useImperativeHandle(ref, createHandle, [deps]);
const = ({
className = '',
// props,
}) => {
// TODO
return // TODO
}
import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import cs from 'classnames';
import styles from './.scss';
const = ({
className = '',
// props,
}) => {
// TODO
return // TODO
}
export default withStyles(styles)();
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import cs from 'classnames';
import styles from './.scss';
class extends Component {
static propTypes = {
// propName: PropTypes.string,
}
static defaultProps = {
// propName: "",
}
state = {
// stateName: "",
}
render() {
const { propName } = this.props;
const { stateName } = this.state;
return (
// TODO
)
}
}
export default withStyles(styles)();
static propTypes = {
: PropTypes.string,
}
static defaultProps = {
: PropTypes.string,
}
state = {};
handle = ({}) => {};
const handle = () => {};
const {} = this.props;
const {} = this.state;
import React from "react";
import withStyles from "isomorphic-style-loader/lib/withStyles";
import cs from "classnames";
export default ;
export const = () => ;
console.info("msg: ", subst);
console.log("msg: ", subst);
console.error("msg: ", subst);
console.dir(obj);
console.table(data, columns);
console.time(label);
console.timeEnd(label);
console.timeLog(label);
console.warn("msg: ", subst);
console.clear();
console.count(label);
/**
* 用一句话介绍此函数是干嘛用的。
*
* @param {string} employee - 参数的介绍文字
* @return {string} 函数返回的数据
*
* @example
*
* const xx = foo('hello')
*/
font-size: 16px;
line-height: 24px;
width: 1280px;
height: 344px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 100%;
position: relative;
line-height: 24px;
height: 48px;
font-size: 16px;
overflow: hidden;
display: block;
width: 100%;
&:after {
content: "";
position: absolute;
bottom: 0;
right: 0;
width: 150px;
height: 24px;
background: linear-gradient(to right, rgba(0, 0, 0, 0), #ffffff 50%);
}
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);