Styling issue with REACT component - Stack Overflow
巴扎黑
巴扎黑 2017-07-05 10:50:54
0
3
786

For the three-button component as shown in the picture, how can we simply use native JS and REACT to write a simple way of clicking one of the buttons to change the style of one of the buttons? And when clicking other buttons, you can have the same effect (that is, clear the styles of the other two and add the style of the click button)

巴扎黑
巴扎黑

reply all (3)
Peter_Zhu

The click of the button is maintained by state, whether it is clicked. Different states give different styles~~
The second question is that you can definitely only write one p style. It is impossible to write 3 buttons for 3 buttons and 10 buttons for 10 buttons. . . . Make a traversal of the basic data, render many p, give p a default style, and assign a different key to each p to distinguish

This is a modal component. Clicking different buttons will pop up the corresponding content~~~

    某草草

    Set a selected field for each button, select one and clear the other two.
    Dynamicly add styles to buttons based on the selected value.

      黄舟

      Can be implemented using the radio of input

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!