Skip to content

Instantly share code, notes, and snippets.

Artem Rendalf

  • Moscow, Russia
Block or report user

Report or block Rendalf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Rendalf
Rendalf / container.js
Created Dec 21, 2018
MapStateToProps function factory example
View container.js
const createMemoizedFooSelector = (state, ownProps) => {
return memoizeLast((state, ownProps) => ({
a: state.as.filter((a) => a.id === ownProps.id),
b: state.bs.byId[ownProps.id],
}))
}
const createMapStateToProps = () => {
const selectFoo = createMemoizedFooSelector()
View preact-fails-ref.jsx
// failed ref
const MyShinyComponent = ({ isFooShown }) => (
<div className='wrapper'>
{ isFooShown && (
<div className='foo'>Foo</div>
)}
<div
className='bar'
ref={ someRefFunc }
>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
You can’t perform that action at this time.