Issues on Page Transition using Reach-Router, React-Transition-Group and GSAP? - reactjs

I'm having issues on page transition animation using Reach-Router Not React-Router, GSAP, and React-Transition-Group in combination.
I did research and found example on page-transition animation using Reach-Router and React-Transition-Group
https://reach.tech/router/example/animation
This example uses CSS to animate, But I wanted to animate it with GSAP and it uses is pure JavaScript not CSS. So, it mean I wouldn't need to use TransitionGroup and CSSTransition.
Later on I found another example on page transition animation with GSAP.
https://stackblitz.com/edit/gsap-react-route-animation
But it uses react-router not reach-router. Since react-router and reach-router look almost close to each other. I decide to go on my own experiment starting with GSAP, RTG and React-Router so I can have better understanding how it work... Here's my sandbox.
https://codesandbox.io/s/react-router-gsap-pgu24
Animation worked! Then, I did another experiment getting exactly copy of code and convert some area to make it compatible with Reach-Router. Here's my sandbox.
https://codesandbox.io/s/reach-router-gsap-h5rny?fontsize=14
Everything works except for animation. Its been struggling for me to find what's the problem and I not understanding here. Did I missing something? Please need help?

Related

Is there anyway to have React breadcrumbs in VSCode?

VSCode has breadcrumbs which is very useful to navigate between tags in a long HTML file. But in a jsx file the breadcrumbs stop when it reaches the return statement, effectively making this feature non-existent in any rendering part of React.
Is there a setting, an extension or anything that solves this problem? I feel like this should've been a thing by now, with React being around for quite some time.
I did find one VSCode extension called React Outline, but the breadcrumbs doesn't update when I move my cursor around. It doesn't seem to have lots of features either.
React Breadcrumbs VsCode extension already does it nicely. It helps see the React component trees and jump to these components with either outline tab or Cmd+shift+. command.

best approach to navigate pages in react js

Hope you are doing well!
I found different ways of navigation in React Js.
For example
Using Link, NavLink, Redirect Component, history.push and history.replace.
I am a bit confused, which method is perfect or recommended. Thanks.
I'm new to React as well and I think using any sort of Link/Navlink along with the Switch Route is a good way. It helps me sort of modularize the routing, no matter where the path changes from.
As a new learner, you only need to know <Route>, <Switch>, and <Link>. And also <Link> and <a> difference. The rest you mentioned comes with intermediate level React. So, I kindly advise you to take it bit by bit and also try to make your questions more to the point as editor noted in comment.

How to pass data from stencil component to other component in react

I have created one search component using stencil and I'm integrating this stencil codebase with my react application via cdn link. I'm displaying the search component(which was created in stencil) as below in my react codebase :
<custom-search placeholder="Search"></custom-search>
The search component contains a search icon. I need to pass the text in search input field to my react code on click of this icon. How can this be achieved?
Unfortunately I haven't integrate Stencil JS component with React, but passing string data to web component should be working without too much hassle. Do you know if your React app can properly recognize your custom-search component? If not, then you might want to take a look at a link to Stencil JS official document of integrating Stencil JS component to React and make sure component get properly loaded and integrated.
If you know for sure you load the component then not sure why your placeholder is not set within your component - it is just a string after all. Maybe post the custom-search component code, as there might be issue with that (i.e. component lifecycle event you are using might not be doing what you expect to do)
Could you clarify the actual problem, please? :)
Does the component not get rendered, or are you unable to achieve communication from custom-search to the React app?
If the latter is the case, you might want to implement a Custom Event on the Stencil component, to communicate changes back to the consuming app.
As #tomokat mentioned, you should follow the official Stencil React integration docs. This is required, since React cannot handle Custom Events natively, and requires some help from the dev.
Edit: Sorry, I got confused by the first answer. Your title is quite clear, though. If you can show some example code of the component and the React integration, we could probably help in a better way.

Scrolling Navbar in React App

I am building my first React app and I would like to build a rotating / scrolling Navbar Component. A couple of websites with examples of what I'm trying to build are Fandex (the better example) and also Numberfire (although Numberfire's doesn't scroll automatically.
Is there a Javascript library for building a moving Navbar in React?
Thanks!
First of all you need to be a familiar with the React.Component methods. The general is componentWillMount - he gives you the control over the manipulation of any event on the page just after it will be loaded. See: https://reactjs.org/docs/react-component.html#componentwillmount .
For animation rotating you can you the React library - React-Transition-Group (See: https://github.com/reactjs/react-transition-group), that gives you the full control about state changing with css effects wich you want to see on the page.
What about manual scrolling - you need to write the simple onmousedown/onmousemove events with some logic implementation to make it work and after bind it to the component constructor. How the events work in the React - see this manual https://reactjs.org/docs/handling-events.html
To make the full realization wich you want, stackoverflow is a not a lucky place for such huge work, sorry )

React-Redux-Form nested component testing

I am using React-Redux-Form and React-Bootstrap on client side of application.
I'm stuck on how to testing my components. I have made a small project on github with one of my components named LoginModal:
https://github.com/DmitryIvanovIAMM/react-redux-form-login-test/blob/master/src/tests/Foo-test.js.
To start testing, I am following this tutorial https://www.codementor.io/vijayst/unit-testing-react-components-jest-or-enzyme-du1087lh8.
But when I try to .find() button in my rendered component, the result is an array of length zero. So I can't simulate its behaviour. I try find it (button) several different way but unsuccessful. Please, your suggestion.
This issue is with the rendering of Modal component that is part of #react-bootstrap. There is a discussion about it on https://github.com/react-bootstrap/react-bootstrap/issues/876.
The alternative is to use ReactModal from react-modal. Testing it is described on http://remarkablemark.org/blog/2017/05/17/testing-react-modal/

Resources