Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

how to access react inline styling from javascript

$
0
0

I am repurposing an array of react components and I want to change the inline styles that they get generated with. How do I, for instance, console.log the inline styles of a react component?

EDIT: code snippet below:

const pieces = this.props.pieces.map((decl, i) => {
  const isMoving = draggingPiece && i === draggingPiece.index;
  const { x, y, piece } = decode.fromPieceDecl(decl);
  const Piece = pieceComponents[piece];

  return (
    <Draggable
      bounds="parent"
      position={{ x: 0, y: 0 }}
      onStart={this.handleDragStart}
      onDrag={this.handleDrag}
      onStop={this.handleDragStop}
      key={`${piece}-${x}-${y}`}
      >
      <Piece isMoving={isMoving} x={x} y={y} />
    </Draggable>
  );
});

console.log(pieces[8].style) // error

Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>