A
A
Alexander2016-08-22 08:20:30
React
Alexander, 2016-08-22 08:20:30

Reactjs - creating tabs, how to make a tab all?

I started studying reactjs , decided to try to apply it, found the tabs module, everything seems to work, but I would like to make a tab everything, on click so that everything is available
https://jsfiddle.net/x6arc0tc/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Gushchin, 2016-08-22
@Dil0ng

I didn't quite understand your problem. Add another tab and name it "all". Your problem is that you are inserting some code into your client application at runtime in php. So it should never be done. React - used as a renderer in SPA, but in PHP you have to write rest-api and already access it and load data. If you need initial data from PHP - do this:

<html>
  <head>
    <script>
        window.__INITIAL_DATA__ = <?= printInitialData() ?>
    </script>
  </head>
  <body>
    <div class="reactRoot"></div>
    <script src="bundle.js" />
  </body>
</html>

You need to choose how you will store the data. Check out flux implementations (I recommend redux).
And one more note - you need to pass props to the parent constructor.
constructor(props) {

                super(props);

                this.state = {
                    activeIndex : 0
                };
            }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question