以前笔记好像写过…但是是关于map-{}的,这次是关于list-[]的。
var colors = ['red', 'green', 'blue']; var refColors = [...colors, 'yellow']; //colors => ['red', 'green', 'blue'] //refColors => ['red', 'green', 'blue', 'yellow']最后用的还是ag-grid自带的checkbox,方形的,改了这里:
rowSelection: 'single'turns out it’s because… 95% width set in SCSS file only applied when the page is too narrow… (this part I am not sure why) When the page is normal size, I forget to set the width for the outside component that contains it…
https://www.w3schools.com/JSREF/event_preventdefault.asp#:~:text=The preventDefault() method cancels,link from following the URL
When to use PreventDefault( ) vs Return false?
anyway, cellRenderer’s props.data is the row you clicked… props.value is based on the workflow of valueFormatter and so on, like the figure in above link (or more specific, the link below: ) Cell Rendering Flow
still a bit wired, so I put alert component beyond button component finally…
这个用的是React.component,写在render里,本来用的onClick={this.function(param1)},但是每次param1改变这个function就被call,搞死我了,后来改成 onClick={() =>this.function(param1)} 就可以了
https://github.com/FasterXML/jackson-databind/issues/585
private static final ObjectWriter objectWriter = new ObjectMapper().writer(new DefaultPrettyPrinter() .withObjectIndenter(new DefaultIndenter().withLinefeed("\n")));最后用了最朴素的方法,但是感觉也不是都换行了…
message.replace(/,/g, ',\n')That’s because tipTotal is a primitive type double.
Use one of the following methods,
"" +tipTotal; Double.toString(tipTotal); String.valueOf(tipTotal); new Double(tipTotal).toString(); String.format("%f", tipTotal) ;本来想用stream类似的,但没找到类似的fancy的方法,有人说用自定义comparator… 最后我用的for(i=0)循环,傻傻的
spy on wrapper.instance() method not called when using shallow()
How To Use spyOn on a function inside of functional component
Actually, move mockStore.dispatch = jest.fn() before Provider solved this question
const mockStore = createStore(combinedReducer, currentState); mockStore.dispatch = jest.fn(); const wrapper = Enzyme.mount( <Provider store={mockStore}> <YourComponent {...props} /> </Provider> );