You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases, giving elements an id is undesirable. It would be better to just be able to pass in an object. For example with React, using IDs break the idea of writing reusable components.
Bad
var space = new CanvasSpace('canvas').setup( {bgcolor: '#f1f5f7'} )
render () {
return (
<canvas id="canvas" />
)
}
Good
var space = new CanvasSpace(this.refs.canvas).setup( {bgcolor: '#f1f5f7'} )
render () {
return (
<canvas ref="canvas" />
)
}
The text was updated successfully, but these errors were encountered:
That's a good point. Will fix this to support React and DOM element as parameter.
It uses "id" because it's much easier for beginners to set an "id" in a div then querying the DOM. But definitely should support more advanced uses too.
In some cases, giving elements an id is undesirable. It would be better to just be able to pass in an object. For example with React, using IDs break the idea of writing reusable components.
Bad
Good
The text was updated successfully, but these errors were encountered: