trevordmiller / Example Render Callback
Licence: mit
An example of sharing stateful logic across React components using the Render Callback (aka Function as Child) pattern
Stars: ✭ 17
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Example Render Callback
Javascript Total
Сборник практических вопросов, задач разного уровня сложности, сниппетов (утилит), паттерны проектирования, а также полезные ссылки по JavaScript
Stars: ✭ 214 (+1158.82%)
Mutual labels: example, pattern
Extending Tea
Example of an extension to The Elm Architecture
Stars: ✭ 30 (+76.47%)
Mutual labels: example, pattern
Machine learning tutorials
Code, exercises and tutorials of my personal blog ! 📝
Stars: ✭ 601 (+3435.29%)
Mutual labels: example
Awesome Kotlin Android
🔥📱收集利用 Kotlin 进行 Android 开发的开源库,扩展,工具,开源项目,资料等高质量资源
Stars: ✭ 784 (+4511.76%)
Mutual labels: example
Nodebootstrap
NodeBootstrap - generates skeleton project for Node/Express.js with pre-configured best-practices. Kick-start your Node project development with tons of boilerplate taken care of, such as: clustering, Docker-support, database migrations, automated testing, error-handling, modularity, advanced logging, templated views, environments etc.
Stars: ✭ 707 (+4058.82%)
Mutual labels: example
Amazon Sagemaker Examples
Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.
Stars: ✭ 6,346 (+37229.41%)
Mutual labels: example
Example.v2
An example project for book 'Go Programming & Concurrency in Practice, 2nd edition' (《Go并发编程实战》第2版).
Stars: ✭ 722 (+4147.06%)
Mutual labels: example
Traces.vim
Range, pattern and substitute preview for Vim
Stars: ✭ 568 (+3241.18%)
Mutual labels: pattern
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+169464.71%)
Mutual labels: example
Guardclauses
A simple package with guard clause extensions.
Stars: ✭ 767 (+4411.76%)
Mutual labels: pattern
Spectre Attack
Example of using revealed "Spectre" exploit (CVE-2017-5753 and CVE-2017-5715)
Stars: ✭ 690 (+3958.82%)
Mutual labels: example
Meta Typing
📚 Functions and algorithms implemented purely with TypeScript's type system
Stars: ✭ 628 (+3594.12%)
Mutual labels: example
Commonregex
🍫 A collection of common regular expressions for Go
Stars: ✭ 733 (+4211.76%)
Mutual labels: pattern
Vulkan minimal compute
Minimal Example of Using Vulkan for Compute Operations. Only ~400LOC.
Stars: ✭ 603 (+3447.06%)
Mutual labels: example
Scala Pet Store
An implementation of the java pet store using FP techniques in scala
Stars: ✭ 812 (+4676.47%)
Mutual labels: example
Business Machine Learning
A curated list of practical business machine learning (BML) and business data science (BDS) applications for Accounting, Customer, Employee, Legal, Management and Operations (by @firmai)
Stars: ✭ 575 (+3282.35%)
Mutual labels: example
Industry Machine Learning
A curated list of applied machine learning and data science notebooks and libraries across different industries (by @firmai)
Stars: ✭ 6,077 (+35647.06%)
Mutual labels: example
Wire Render Pattern
☄️ Wire Render Pattern for Processwire
Stars: ✭ 16 (-5.88%)
Mutual labels: pattern
example-render-callback
An example of sharing stateful logic across React components using the Render Callback (aka Function as Child) pattern
The Code
See the components/
directory; it contains a Toggle
component, which is a Render Callback. This Toggle
component is used in the Accordian
, Modal
, and Thumbnail
components to show how the stateful logic can be reused across each of these stateless functional components.
Try it
The app can be viewed at https://example-render-callback.now.sh
Syntax
The syntax for a Render Callback looks like this:
import {Component} from 'react'
class SomeComponent extends Component {
this.state = {
someState: someValue,
}
render() {
return this.props.children(this.state.someState)
}
}
export default SomeComponent
Then it can be used like this:
import React from 'react'
const AnotherComponent = () => (
<SomeComponent>
{(someState) => (
// use someState
)}
</SomeComponent>
)
export default AnotherComponent
Contributing
See CONTRIBUTING.md
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].