Unpacking using bootstrap reaction works in building a static file, but not when servicing with a web server

I have a simple layout of pages that respond to reaction-bootstrap and reaction-mini-router.

I use the same code in the action-bootstrap example to navigate the dropdown menu:

render: function() {
        var userName = 'Superman';
        return (
            <Navbar brand="React-Bootstrap">
                <Nav>
                    <NavItem eventKey={1} href="/">Home</NavItem>
                    <NavItem eventKey={2} href="/About">About</NavItem>
                    <NavDropdown eventKey={3} title={userName} id="basic-nav-dropdown" onClick={this.userNameClick}>
                        <MenuItem eventKey="1">Action</MenuItem>
                        <MenuItem eventKey="2">Another action</MenuItem>
                        <MenuItem eventKey="3">Something else here</MenuItem>
                        <MenuItem divider />
                        <MenuItem eventKey="4">Separated link</MenuItem>
                    </NavDropdown>
                </Nav>
            </Navbar>
            )
    }

});

When I create a page and open the index, as you see here , the drop-down menu works as expected and just drops the menu without navigating the page, regardless of whether you are in the “house” or “about”.

However, when I use gulp -connect or python SimpleHTTPServer to serve the page on the local host, clicking the dropdown menu always changes / puts the page in the "home" one, although the dropdown menu is not a link.

?

, , gulp, -.

+4
1

: -bootstrap response-mini-router, / this Github.

handleClick RouterMixin.

handleClick: function(evt) {
    var dropdownevt = (evt.path[0].id === 'acc-dropdown');
        if (url && self.matchRoute(url.pathname) && !dropdownevt) {    ...
0

Source: https://habr.com/ru/post/1607847/


All Articles