Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Use class list and implicit ... identifier #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 01 - Core/08 - Transferring Props.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HTML as JSX, joinClasses } from "react-dom";
import { HTML as JSX } from "react-dom";

// Draft

Expand All @@ -19,7 +19,7 @@ class FancyButton {
// This uses rest and spread operators
// https://gist.github.com/sebmarkbage/aa849c7973cb4452c547

render({ color, className, style, width, height, ...other }) {
render({ color, classList, style, width, height, ...other }) {
// The rest operator picks off the remaining props that you're not using.
// The linter analyses this method and notices the JSX spread attribute.
// Therefore it warns you not to use this.props.propertyName and instead
Expand All @@ -28,8 +28,8 @@ class FancyButton {
var button =
<button
{...other}
className={joinClasses(className, 'FancyButton')}
style={{ ...style,
classList={[ ..., 'FancyButton' ]}
style={{ ...,
backgroundColor: color,
padding: 10,
width: width - 10,
Expand All @@ -39,7 +39,7 @@ class FancyButton {

/**
* button.props === {
* className: 'test FancyButton',
* classList: ['test', 'FancyButton'],
* disabled: true,
* style: {
* backgroundColor: 'blue',
Expand Down