Languages
[Edit]
PL

React - pasek postępu

0 points
Created by:
Zayaan-Rasmussen
533

W tym krótkim artykule chcielibyśmy pokazać, jak stworzyć własny pasek postępu w Reakcie.

Uwaga:

W tym artykule dowiesz się, jak utworzyć animowany pasek postępu.

Praktyczny przykład:

// ONLINE-RUNNER:browser;

// import React from 'react';
// import ReactDOM from 'react-dom';

const containerStyle = {
  	border: '1px solid silver',
  	background: '#ededed'
};

const contentStyle = {
  	background: '#00cc00',
  	height: '24px',
  	textAlign: 'center',
  	lineHeight: '24px',
  	fontFAmily: 'sans-serif'
};

const ProgressBar = ({progress}) => {
  	const state = `${progress}%`;
    return (
      <div style={containerStyle}>
        <div style={{...contentStyle, width: state}}>
          {progress > 5 ? state : ''}
        </div>
      </div>
    );
};

const App = () => {
  return (
    <div>
      <ProgressBar progress={0} />
      <br />
      <ProgressBar progress={5} />
      <br />
      <ProgressBar progress={20} />
      <br />
      <ProgressBar progress={50} />
      <br />
      <ProgressBar progress={75} />
      <br />
      <ProgressBar progress={100} />
    </div>
  );
};

const root = document.querySelector('#root');
ReactDOM.render(<App />, root);

Alternative titles

  1. React - jak stworzyć pasek postępu
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

ReactJS (PL)

React - pasek postępu
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join