0

I have a simple started project in react and I am trying to use conic-gradient in react. Here is the code :

import React, {Component} from 'react';




export default class App extends Component {
    constructor(props) {
        super(props);



    }



    render(){

        return(
            <div>
                <div style = {styles.progressCircle}></div>

            </div>
        );
    }
}

const styles = {
    progressCircle : {
        width: "100px",
        height: "100px",
        borderRadius: "50%",
        background: "conicGradient(red 4%, gray 0 8%, blue 0 17%,yellow 0 48%,purple 0 54%, orange 0)"
    }
}

Nothing shows up on the screen . why is that?

1

1 Answer 1

1

changed your sample to run code snippet

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.0.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.0.0/umd/react-dom.production.min.js"></script>
<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.0/react.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/15.2.0/react-dom.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.25/browser-polyfill.min.js"></script>
</head>

<body>
    <div id="app_root"></div>
      
    <script type="text/babel">
    
const styles = {
    progressCircle : {
        width: "200px",
        height: "200px",
        borderRadius: "50%",
        background: "conic-gradient(red 4%, gray 0 8%, blue 0 17%,yellow 0 48%,purple 0 54%, orange 0)"
    }
}    
        var Hello = React.createClass({ 
            render: function() { 
                return(
                    <div style = {styles.progressCircle}></div>
                ); 
            } 
       }); 

       ReactDOM.render(<Hello />, document.getElementById("app_root"));
    </script>
</body>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.