Writing codes without mindset is a mess. Use one of React advanced patterns to enhance your code base by Higher Order Component.
Please check demo repo for more detail: https://github.com/xJkit/trendmicro-fed-talk-pattern-hoc
Use React Patterns to Build Large Scalable App Yao Nien Chung
Use React advanced design patterns to build or refactor components, including Container Component Pattern, Compound Component Pattern, Higher Order Component Pattern, and the Render Props Pattern which is the most popular pattern in this year.
Please check the demo codes for more detail >>> https://github.com/xJkit/modern-web-2018-demo
Selenide is simple and powerful in use wrapper-library over Selenium. But what the point just of shorter lines of code? In this talk we will see how to tame your webui mustang with Selenide and put it into fence of simple BDD stories with Easyb. We also consider pros and cons of the approach and compare to available alternatives.
Use React Patterns to Build Large Scalable App Yao Nien Chung
Use React advanced design patterns to build or refactor components, including Container Component Pattern, Compound Component Pattern, Higher Order Component Pattern, and the Render Props Pattern which is the most popular pattern in this year.
Please check the demo codes for more detail >>> https://github.com/xJkit/modern-web-2018-demo
Selenide is simple and powerful in use wrapper-library over Selenium. But what the point just of shorter lines of code? In this talk we will see how to tame your webui mustang with Selenide and put it into fence of simple BDD stories with Easyb. We also consider pros and cons of the approach and compare to available alternatives.
This talk was given at "Easy Automation in Python" meetup (https://www.meetup.com/Test-Fanatic-MeetUp/events/236481850/).
The talk is about some easy approaches in building web ui automation in python.
As an "easy tool" the selene library is uses.
src code for the talk: https://github.com/yashaka/talks/tree/master/easy-automation-py
Slides from "Polyglot Automation" talk given at QA Fest conference.
There are many good programming languages. But test automation is preety simple so the power of language will not matter. But choosing language does matter for effective automation. How to choose the language for Web UI automation? Why Web UI automation is easy? How to choose easyy tools for your automation? How to learn new language and why? We will try to answer all these questions in this talk.
Unit testing helps improving the quality of your code and greatly simplifies dealing with complex code. The testing framework of choice for React.js is Jest.
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Iakiv Kramarenko
Talk given on SeleniumCamp 2016 about:
- Main Selenide Features from Implementation point of view
- Examples of porting these features to python (using simplified Selene sources)
This talk can be considered as a HOWTO on porting Selenide to any language, if the following programming paradigms are considered as tools: Procedural, Modular, OOP.
Web ui tests examples with selenide, nselene, selene & capybaraIakiv Kramarenko
Code Examples Cut from Polyglot Automation talk given at QA Fest
full video: https://www.youtube.com/watch?v=D4w8btYlbRY
full presentation: http://www.slideshare.net/yashaka/polyglot-automation-qa-fest-2015
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
***VIDEO***: view in SD at http://youtu.be/HPHKeBakulQ or download in HD at http://bit.ly/1nyvA67
Often we have lack of automation resources. If we just would involve less experienced juniors to implement test model and even Manual QA to write DSL like tests…
In this talk I want to present the simplified approach to write PageObjects for your test model as it would be like playing “three chords” song on a guitar. And also share the experience of pacifying the LoadableComponent pattern, rather hard in implementation but making your tests much more DRY and easy to use in context of loading pages.
From Good to Great: Functional and Acceptance Testing in WordPress.David Aguilera
In this presentation, I introduce Codeception as one of the most powerful tools for running Acceptance and Functional Tests in your WordPress.
WordCamp Europe 2015.
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]Iakiv Kramarenko
Talk given on SeleniumCamp 2016 about:
- What features should a "general web test automation tool" have
- Why Selenide is the one Java
- And Selene is the other in Python
- And how to use the latter
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
An overview of different approaches to Page Objects and Domain Objects for GUI Automation. Examples use WebDriver and Java.
Full source code is available to download, For more details see the associated blog post.
These are training slides created by me to conduct training and knowledge sharing sessions for beginners in Cognizant Technology Solutions for Selenium Automation.
A set of slides that you can use to 'cheatsheet' your way to Selenium 2 WebDriver mastery. Formatted as the handouts I use on my Selenium WebDriver training.
Confused by testing terms and jargon? This talk walks through testing web applications, explaining the difference between unit testing and end to end testing. Several tools and concepts are also explored through a demo section.
Sample projects can be found at https://github.com/sethmcl/testing_web_applications.
Introducing Playwright's New Test RunnerApplitools
Playwright Test is a new test runner built from scratch by the Playwright team specifically to accommodate end-to-end testing needs. Join Principal Engineer, Andrey Lushinkov as he demonstrates how to use Playwright Test to author new tests, how to migrate existing tests, how to deploy them on CI, and debug them if something goes wrong.
React is a UI library that is changing the way web applications are written. While there are many benefits to using React, managing an application's complexity as it scales is one of the most powerful.
Fundamental Concepts of React JS for Beginners.pdfStephieJohn
Let’s look into the Fundamental concepts of React Js for beginners by Lia Infraservices – The top Mobile App Development Company in Chennai. React is a front-end open source JavaScript library for creating user interfaces (UI) components. Complex user interfaces are broken down into small “components,” which are separate pieces of “reusable codes”.
This talk was given at "Easy Automation in Python" meetup (https://www.meetup.com/Test-Fanatic-MeetUp/events/236481850/).
The talk is about some easy approaches in building web ui automation in python.
As an "easy tool" the selene library is uses.
src code for the talk: https://github.com/yashaka/talks/tree/master/easy-automation-py
Slides from "Polyglot Automation" talk given at QA Fest conference.
There are many good programming languages. But test automation is preety simple so the power of language will not matter. But choosing language does matter for effective automation. How to choose the language for Web UI automation? Why Web UI automation is easy? How to choose easyy tools for your automation? How to learn new language and why? We will try to answer all these questions in this talk.
Unit testing helps improving the quality of your code and greatly simplifies dealing with complex code. The testing framework of choice for React.js is Jest.
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Iakiv Kramarenko
Talk given on SeleniumCamp 2016 about:
- Main Selenide Features from Implementation point of view
- Examples of porting these features to python (using simplified Selene sources)
This talk can be considered as a HOWTO on porting Selenide to any language, if the following programming paradigms are considered as tools: Procedural, Modular, OOP.
Web ui tests examples with selenide, nselene, selene & capybaraIakiv Kramarenko
Code Examples Cut from Polyglot Automation talk given at QA Fest
full video: https://www.youtube.com/watch?v=D4w8btYlbRY
full presentation: http://www.slideshare.net/yashaka/polyglot-automation-qa-fest-2015
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
***VIDEO***: view in SD at http://youtu.be/HPHKeBakulQ or download in HD at http://bit.ly/1nyvA67
Often we have lack of automation resources. If we just would involve less experienced juniors to implement test model and even Manual QA to write DSL like tests…
In this talk I want to present the simplified approach to write PageObjects for your test model as it would be like playing “three chords” song on a guitar. And also share the experience of pacifying the LoadableComponent pattern, rather hard in implementation but making your tests much more DRY and easy to use in context of loading pages.
From Good to Great: Functional and Acceptance Testing in WordPress.David Aguilera
In this presentation, I introduce Codeception as one of the most powerful tools for running Acceptance and Functional Tests in your WordPress.
WordCamp Europe 2015.
Selenide alternative in Python - Introducing Selene [SeleniumCamp 2016]Iakiv Kramarenko
Talk given on SeleniumCamp 2016 about:
- What features should a "general web test automation tool" have
- Why Selenide is the one Java
- And Selene is the other in Python
- And how to use the latter
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
An overview of different approaches to Page Objects and Domain Objects for GUI Automation. Examples use WebDriver and Java.
Full source code is available to download, For more details see the associated blog post.
These are training slides created by me to conduct training and knowledge sharing sessions for beginners in Cognizant Technology Solutions for Selenium Automation.
A set of slides that you can use to 'cheatsheet' your way to Selenium 2 WebDriver mastery. Formatted as the handouts I use on my Selenium WebDriver training.
Confused by testing terms and jargon? This talk walks through testing web applications, explaining the difference between unit testing and end to end testing. Several tools and concepts are also explored through a demo section.
Sample projects can be found at https://github.com/sethmcl/testing_web_applications.
Introducing Playwright's New Test RunnerApplitools
Playwright Test is a new test runner built from scratch by the Playwright team specifically to accommodate end-to-end testing needs. Join Principal Engineer, Andrey Lushinkov as he demonstrates how to use Playwright Test to author new tests, how to migrate existing tests, how to deploy them on CI, and debug them if something goes wrong.
React is a UI library that is changing the way web applications are written. While there are many benefits to using React, managing an application's complexity as it scales is one of the most powerful.
Fundamental Concepts of React JS for Beginners.pdfStephieJohn
Let’s look into the Fundamental concepts of React Js for beginners by Lia Infraservices – The top Mobile App Development Company in Chennai. React is a front-end open source JavaScript library for creating user interfaces (UI) components. Complex user interfaces are broken down into small “components,” which are separate pieces of “reusable codes”.
We will know the real purpose of the React and see how it can help us build componentized interfaces besides understanding the core concepts of core: Virtual DOM, JSX, Components (props, states, lifecycle) and Unidirectional Data Flow.
react-slides.pdf gives information about react libraryjanet736113
React is a framework that employs Webpack to automatically compile React, JSX, and ES6 code while handling CSS file prefixes. React is a JavaScript-based UI development library. Although React is a library rather than a language, it is widely used in web development. The library first appeared in May 2013 and is now one of the most commonly used frontend libraries for web development.
React offers various extensions for entire application architectural support, such as Flux and React Native, beyond mere UI,When compared to other technologies on the market, React is a new technology. Jordan Walke, a software engineer at Facebook, founded the library in 2011, giving it life. The likes of XHP, a straightforward HTML component framework for PHP, have an influence on React. React's newsfeed was its debut application in 2011. Later, Instagram picks it up and incorporates it into their platform,
Advantages
Makes use of the JavaScript structure known as virtual DOM. Since JavaScript's virtual DOM is quicker than the conventional DOM, this will boost the speed of programs.
Can be used with various systems and on both client and server sides is commendable.
Components and identify trends make larger apps easier to manage by increasing clarity.
Limitations
Only addresses the app's angle and distance; as a result, additional techniques must be selected if you want a full collection of development tools.
Employs inline scripting and JSX, which some programmers might find uncomfortable.
At Lia Infraservice we create Dynamic Websites. Become a front-end React JS developer and be a part of our tech-savvy Web App Development Company in Chennai.
React is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and companies. React can be used as a base in the development of single-page or mobile application
Intro deck on React, presented at the Ottawa JS Sept. 2015 meetup.
Github repo for the Poop Monitor app: https://github.com/blefebvre/react-poop-monitor
Deck was built with Spectacle: https://github.com/FormidableLabs/spectacle
Source: https://github.com/blefebvre/react-ottawajs-spectacle-deck
React for Re-use: Creating UI Components with Confluence ConnectAtlassian
Using React to create reusable components for Confluence extension points saves time and allows for a richer user experience. Join Matt Jensen, an Atlassian developer for over 10 years, for a session on using React to modularise the UI layer of your Confluence add-on, then bringing it together to take advantage of the common components. Matt will demonstrate the benefits of React for UI elements like macros, pages, and dialogs.
Matthew Jensen, Development Team Lead, Atlassian
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
Enhance react app with patterns - part 1: higher order component
1. Enhance React app with patterns
part 1: Higher Order Component
Jay Chung (xJkit)
https://github.com/xJkit
2. https://github.com/xJkit
Sr. Front End Developer
About Me
https://linkedin.com/in/xjkit54780
https://slideshare.net/JOEYCHUNG2
https://twitter.com/xJkit
Jay Chung
14. Props
render() {
const { a, b, c } = functionA(9,4,8,7);
let d;
switch (a) {
case BLUE:
….
d = functionB(5);
break;
case RED:
….
d = functionC(6);
break;
default:
d = “default value”;
break;
}
// ….otherHeavyCompute(9,4,8,7)
20. Higher Order Component
• Takes one or more components as arguments
• Returns a component as its result
21. Higher Order Component
const BaseComponent = props => {...}
let EnhancedComponent = pure(BaseComponent)
EnhancedComponent = mapProps(/*...args*/)(EnhancedComponent)
EnhancedComponent = withState(/*...args*/)(EnhancedComponent)
const composedHoc = BaseComponent => hoc1(hoc2(hoc3(BaseComponent)))
or you can compose them:
22. Higher Order Component
const App = React.createClass({
render() {
// Instead of maintaining our own state,
// we get the mouse position as a prop!
const { x, y } = this.props.mouse
return (
<div style={{ height: '100%' }}>
<h1>The mouse position is ({x}, {y})</h1>
</div>
)
}
})
const withMouse = (Component) => {
return class extends React.Component {
state = { x: 0, y: 0 }
handleMouseMove = (event) => {
this.setState({
x: event.clientX,
y: event.clientY
})
}
render() {
return (
<div style={{ height: '100%' }} onMouseMove={this.handleMouseMove}>
<Component {...this.props} mouse={this.state}/>
</div>
)
}
}
}
App.js withMouse.js
Enhance you
23. Higher Order Component
• Code reuse, logic and bootstrap abstraction
• Render Highjacking
• State abstraction and manipulation
• Props manipulation
const AppWithMouse = withMouse(App)
24. A React utility belt for function components and higher-order components.
Recompose
Think of it like lodash for React.
25. Recompose
• …lift state into functional wrappers
• ...perform the most common React patterns
• ...optimize rendering performance
• ...interoperate with other libraries
31. Recompose
• Separate logics to the HoCs (enhancers)
• Make base component to be pure (if no defaultProps)
• Make base component more readable
• Make base component easier to test
32. HoCs 的使⽤用場景
• Lift States Up
• Common Tasks
• Performance Optimizations
• Observables
33. Lift States Up
• withProps
• withState
• withHandlers
• withStateHandlers
42. Ref in HoCs
• If you add a ref to a HOC, the ref will refer to the
outermost container component, not the wrapped
component.
• That’s because ref is not a prop. Like key, it’s handled
differently by React.
43. Ref in HoCs
• Rename ref prop -> innerRef, otherRef, … whatever
• React v16.3 comes to the rescue: forwardRef
44. babel-plugin-lodash
import compose from ‘recompose/compose’
import withState from ‘recompose/withState’
import { compose, withState } from ‘recompose’
==== equals to ====