SolidJSS
SolidJSโ€ข3y agoโ€ข
1 reply
peterszw

How props.children get informed in router.jsx value change ? eg: logined =true,children refresh

//app.jsx
const App = (props) => {
  const [logined, setLogined] = createSignal(false);
  return (
    <>
      <button ...>Login</button>
       {props.children}
    </>
  )
}

render(
  () => (
    <Router root={App}>
      <Route path="/" component={home} />
      <Route path="/board" component={board} />
      <Route path="/setting" component={setting} />
    </Router>
  ),
  document.getElementById("app")
);
    

for example : after app.jsx have an ajax call and set logined =true , how to let child call a function to refresh the data ? how to use props to do this ? please give some example code.
Was this page helpful?